@dxos/plugin-markdown 0.9.0 → 0.9.1-staging.ee54ba693a
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/neutral/{MarkdownArticle-LWT5RFFJ.mjs → MarkdownArticle-ZHBXH7YF.mjs} +5 -7
- package/dist/lib/neutral/MarkdownArticle-ZHBXH7YF.mjs.map +7 -0
- package/dist/lib/neutral/{MarkdownCard-TBLIRDBO.mjs → MarkdownCard-2HUXCGZP.mjs} +3 -3
- package/dist/lib/neutral/MarkdownCard-2HUXCGZP.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownPlugin.mjs +8 -15
- package/dist/lib/neutral/MarkdownPlugin.mjs.map +3 -3
- package/dist/lib/neutral/MarkdownPlugin.node.mjs +4 -2
- package/dist/lib/neutral/MarkdownPlugin.node.mjs.map +3 -3
- package/dist/lib/neutral/MarkdownPlugin.workerd.mjs +6 -17
- package/dist/lib/neutral/MarkdownPlugin.workerd.mjs.map +4 -4
- package/dist/lib/neutral/MarkdownSettings-5VMOYMND.mjs +43 -0
- package/dist/lib/neutral/MarkdownSettings-5VMOYMND.mjs.map +7 -0
- package/dist/lib/neutral/{anchor-sort-UXN4RHFX.mjs → anchor-sort-QF7UDG2A.mjs} +4 -3
- package/dist/lib/neutral/anchor-sort-QF7UDG2A.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +10 -16
- package/dist/lib/neutral/capabilities/index.mjs.map +3 -3
- package/dist/lib/neutral/capabilities/node.mjs +5 -3
- package/dist/lib/neutral/capabilities/node.mjs.map +3 -3
- package/dist/lib/neutral/chunk-2V6A5NDQ.mjs +8 -0
- package/dist/lib/neutral/{operation-handler-2ARMPBGZ.mjs → chunk-ANHHOTCD.mjs} +3 -4
- package/dist/lib/neutral/{operation-handler-2ARMPBGZ.mjs.map → chunk-ANHHOTCD.mjs.map} +1 -1
- package/dist/lib/neutral/chunk-CNYFGIDS.mjs +32 -0
- package/dist/lib/neutral/chunk-CNYFGIDS.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-LXNSKCPD.mjs → chunk-EV4ZOL4P.mjs} +12 -11
- package/dist/lib/neutral/chunk-EV4ZOL4P.mjs.map +7 -0
- package/dist/lib/neutral/chunk-OC3JD73N.mjs +43 -0
- package/dist/lib/neutral/chunk-OC3JD73N.mjs.map +7 -0
- package/dist/lib/neutral/chunk-YJF6XOXX.mjs +175 -0
- package/dist/lib/neutral/chunk-YJF6XOXX.mjs.map +7 -0
- package/dist/lib/neutral/chunk-YMBC62S7.mjs +14 -0
- package/dist/lib/neutral/chunk-YMBC62S7.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-Y2LQRUU7.mjs → chunk-ZJ3GWRUJ.mjs} +24 -23
- package/dist/lib/neutral/chunk-ZJ3GWRUJ.mjs.map +7 -0
- package/dist/lib/neutral/{comment-config-EGY7RPPW.mjs → comment-config-M5OGFULS.mjs} +6 -4
- package/dist/lib/neutral/comment-config-M5OGFULS.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +19 -57
- package/dist/lib/neutral/components/index.mjs.map +4 -4
- package/dist/lib/neutral/containers/index.mjs +5 -3
- package/dist/lib/neutral/containers/index.mjs.map +3 -3
- package/dist/lib/neutral/{create-JK35XC4R.mjs → create-OQUMKL5I.mjs} +2 -2
- package/dist/lib/neutral/{create-markdown-7MLE625M.mjs → create-markdown-4O5FDA77.mjs} +2 -2
- package/dist/lib/neutral/{create-object-MU2LGXG6.mjs → create-object-RSEWTCMM.mjs} +2 -6
- package/dist/lib/neutral/create-object-RSEWTCMM.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +53 -23
- package/dist/lib/neutral/hooks/index.mjs.map +3 -3
- package/dist/lib/neutral/index.mjs +10 -16
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/meta.mjs +1 -1
- package/dist/lib/neutral/{open-5YC77C4O.mjs → open-BAZIRXII.mjs} +2 -2
- package/dist/lib/neutral/operation-handler-SDCXGMGK.mjs +8 -0
- package/dist/lib/neutral/operations/index.mjs +1 -1
- package/dist/lib/neutral/plugin.mjs +2 -2
- package/dist/lib/neutral/plugin.workerd.mjs +12 -0
- package/dist/lib/neutral/plugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/{react-surface-XYZJBKHZ.mjs → react-surface-37GL3UVG.mjs} +10 -15
- package/dist/lib/neutral/react-surface-37GL3UVG.mjs.map +7 -0
- package/dist/lib/neutral/{scroll-to-anchor-GAFB7W55.mjs → scroll-to-anchor-I6HFE5AH.mjs} +2 -2
- package/dist/lib/neutral/{set-view-mode-N7UHYMPG.mjs → set-view-mode-NY5OYYIM.mjs} +2 -2
- package/dist/lib/neutral/{settings-TDGDLCUR.mjs → settings-O6O6HT3I.mjs} +3 -3
- package/dist/lib/neutral/settings-O6O6HT3I.mjs.map +7 -0
- package/dist/lib/neutral/skill-definition-ET7BYY47.mjs +8 -0
- package/dist/lib/neutral/skill-definition-ET7BYY47.mjs.map +7 -0
- package/dist/lib/neutral/skills/index.mjs +8 -0
- package/dist/lib/neutral/skills/index.mjs.map +7 -0
- package/dist/lib/neutral/state-3BR7L6CW.mjs +69 -0
- package/dist/lib/neutral/state-3BR7L6CW.mjs.map +7 -0
- package/dist/lib/neutral/testing.mjs +2 -2
- package/dist/lib/neutral/testing.mjs.map +3 -3
- package/dist/lib/neutral/translations.mjs +1 -1
- package/dist/lib/neutral/translations.mjs.map +3 -3
- package/dist/lib/neutral/types/index.mjs +1 -1
- package/dist/lib/neutral/update-markdown-M4PTA6VS.mjs +24 -0
- package/dist/lib/neutral/update-markdown-M4PTA6VS.mjs.map +7 -0
- package/dist/types/dx.config.d.ts +28 -0
- package/dist/types/dx.config.d.ts.map +1 -0
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/MarkdownPlugin.node.d.ts.map +1 -1
- package/dist/types/src/MarkdownPlugin.workerd.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort.d.ts +1 -2
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -1
- package/dist/types/src/capabilities/comment-config.d.ts +1 -2
- package/dist/types/src/capabilities/comment-config.d.ts.map +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +1 -7
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -1
- package/dist/types/src/capabilities/editor-view-state.d.ts +7 -0
- package/dist/types/src/capabilities/editor-view-state.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +7 -16
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +2 -6
- package/dist/types/src/capabilities/node.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/skill-definition.d.ts +5 -0
- package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +1 -2
- package/dist/types/src/capabilities/state.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 +5 -6
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts +3 -2
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +2 -2
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -1
- package/dist/types/src/components/PreviewComponent/PreviewComponent.d.ts +17 -0
- package/dist/types/src/components/PreviewComponent/PreviewComponent.d.ts.map +1 -0
- package/dist/types/src/components/PreviewComponent/index.d.ts +2 -0
- package/dist/types/src/components/PreviewComponent/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownArticle/MarkdownArticle.d.ts +6 -17
- package/dist/types/src/containers/MarkdownArticle/MarkdownArticle.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownArticle/MarkdownArticle.stories.d.ts.map +1 -1
- package/dist/types/src/{components → containers}/MarkdownSettings/MarkdownSettings.d.ts +1 -1
- package/dist/types/src/{components → containers}/MarkdownSettings/MarkdownSettings.d.ts.map +1 -1
- package/dist/types/src/{components → containers}/MarkdownSettings/MarkdownSettings.stories.d.ts.map +1 -1
- package/dist/types/src/{components → containers}/MarkdownSettings/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +1 -0
- package/dist/types/src/containers/index.d.ts.map +1 -1
- 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 +2 -2
- package/dist/types/src/hooks/useLinkQuery.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 +32 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/update-markdown.d.ts.map +1 -1
- package/dist/types/src/plugin.workerd.d.ts +2 -0
- package/dist/types/src/plugin.workerd.d.ts.map +1 -0
- package/dist/types/src/skills/index.d.ts +2 -0
- package/dist/types/src/skills/index.d.ts.map +1 -0
- package/dist/types/src/skills/markdown-skill.d.ts +4 -0
- package/dist/types/src/skills/markdown-skill.d.ts.map +1 -0
- package/dist/types/src/types/Markdown.d.ts +12 -20
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownCapabilities.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownOperation.d.ts +5 -28
- package/dist/types/src/types/MarkdownOperation.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +2 -0
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +31 -0
- package/package.json +67 -59
- package/src/MarkdownPlugin.node.ts +2 -1
- package/src/MarkdownPlugin.test.ts +1 -1
- package/src/MarkdownPlugin.tsx +7 -16
- package/src/MarkdownPlugin.workerd.ts +5 -2
- package/src/capabilities/anchor-sort.ts +3 -2
- package/src/capabilities/comment-config.ts +6 -9
- package/src/capabilities/create-object.ts +1 -4
- package/src/capabilities/editor-view-state.ts +28 -0
- package/src/capabilities/index.ts +2 -16
- package/src/capabilities/node.ts +1 -0
- package/src/capabilities/react-surface.tsx +29 -13
- package/src/capabilities/settings.ts +2 -2
- package/src/capabilities/skill-definition.ts +14 -0
- package/src/capabilities/state.ts +8 -4
- package/src/components/MarkdownEditor/FileUpload.tsx +2 -2
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +72 -30
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +14 -40
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +7 -6
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +2 -2
- package/src/components/PreviewComponent/PreviewComponent.tsx +195 -0
- package/src/components/PreviewComponent/index.ts +5 -0
- package/src/components/index.ts +1 -4
- package/src/containers/MarkdownArticle/MarkdownArticle.stories.tsx +3 -4
- package/src/containers/MarkdownArticle/MarkdownArticle.tsx +6 -6
- package/src/containers/MarkdownCard/MarkdownCard.tsx +2 -2
- package/src/{components → containers}/MarkdownSettings/MarkdownSettings.stories.tsx +1 -1
- package/src/containers/MarkdownSettings/MarkdownSettings.tsx +54 -0
- package/src/containers/index.ts +1 -0
- package/src/hooks/useEditorMenuOptions.ts +2 -2
- package/src/hooks/useExtensions.tsx +42 -22
- package/src/hooks/useLinkQuery.ts +5 -3
- package/src/index.ts +1 -2
- package/src/meta.ts +2 -22
- package/src/operations/create.conversations.json +1 -1
- package/src/operations/create.test.ts +5 -12
- package/src/operations/update-markdown.ts +7 -27
- package/src/operations/update.conversations.json +1 -1
- package/src/operations/update.test.ts +86 -16
- package/src/plugin.workerd.ts +5 -0
- package/src/skills/index.ts +5 -0
- package/src/{blueprints/markdown-blueprint.ts → skills/markdown-skill.ts} +8 -7
- package/src/testing.ts +2 -2
- package/src/translations.ts +1 -1
- package/src/types/Markdown.ts +20 -19
- package/src/types/MarkdownCapabilities.ts +7 -5
- package/src/types/MarkdownEvents.ts +1 -1
- package/src/types/MarkdownOperation.ts +12 -6
- package/src/types/types.ts +2 -7
- package/dist/lib/neutral/MarkdownArticle-LWT5RFFJ.mjs.map +0 -7
- package/dist/lib/neutral/MarkdownCard-TBLIRDBO.mjs.map +0 -7
- package/dist/lib/neutral/MarkdownSettings-YCTZJL5V.mjs +0 -32
- package/dist/lib/neutral/MarkdownSettings-YCTZJL5V.mjs.map +0 -7
- package/dist/lib/neutral/anchor-sort-UXN4RHFX.mjs.map +0 -7
- package/dist/lib/neutral/app-graph-builder-BWBA23FF.mjs +0 -67
- package/dist/lib/neutral/app-graph-builder-BWBA23FF.mjs.map +0 -7
- package/dist/lib/neutral/app-graph-serializer-EN5E3BMG.mjs +0 -56
- package/dist/lib/neutral/app-graph-serializer-EN5E3BMG.mjs.map +0 -7
- package/dist/lib/neutral/blueprint-definition-DSPXK77L.mjs +0 -15
- package/dist/lib/neutral/blueprint-definition-DSPXK77L.mjs.map +0 -7
- package/dist/lib/neutral/blueprints/index.mjs +0 -8
- package/dist/lib/neutral/chunk-36QFEVOZ.mjs +0 -30
- package/dist/lib/neutral/chunk-36QFEVOZ.mjs.map +0 -7
- package/dist/lib/neutral/chunk-67DKWOKF.mjs +0 -10
- package/dist/lib/neutral/chunk-67DKWOKF.mjs.map +0 -7
- package/dist/lib/neutral/chunk-CIJD7P6X.mjs +0 -8
- package/dist/lib/neutral/chunk-LXNSKCPD.mjs.map +0 -7
- package/dist/lib/neutral/chunk-Y2LQRUU7.mjs.map +0 -7
- package/dist/lib/neutral/comment-config-EGY7RPPW.mjs.map +0 -7
- package/dist/lib/neutral/create-object-MU2LGXG6.mjs.map +0 -7
- package/dist/lib/neutral/navigation-resolver-3KBOMN4U.mjs +0 -14
- package/dist/lib/neutral/navigation-resolver-3KBOMN4U.mjs.map +0 -7
- package/dist/lib/neutral/react-surface-XYZJBKHZ.mjs.map +0 -7
- package/dist/lib/neutral/settings-TDGDLCUR.mjs.map +0 -7
- package/dist/lib/neutral/state-5COCF5PN.mjs +0 -44
- package/dist/lib/neutral/state-5COCF5PN.mjs.map +0 -7
- package/dist/lib/neutral/update-markdown-NNINDDV5.mjs +0 -44
- package/dist/lib/neutral/update-markdown-NNINDDV5.mjs.map +0 -7
- package/dist/types/src/blueprints/index.d.ts +0 -2
- package/dist/types/src/blueprints/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/markdown-blueprint.d.ts +0 -4
- package/dist/types/src/blueprints/markdown-blueprint.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -6
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +0 -5
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation-resolver.d.ts +0 -6
- package/dist/types/src/capabilities/navigation-resolver.d.ts.map +0 -1
- package/dist/types/src/paths.d.ts +0 -3
- package/dist/types/src/paths.d.ts.map +0 -1
- package/src/blueprints/index.ts +0 -5
- package/src/capabilities/app-graph-builder.ts +0 -63
- package/src/capabilities/app-graph-serializer.ts +0 -64
- package/src/capabilities/blueprint-definition.ts +0 -19
- package/src/capabilities/navigation-resolver.ts +0 -19
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +0 -35
- package/src/paths.ts +0 -11
- /package/dist/lib/neutral/{chunk-CIJD7P6X.mjs.map → chunk-2V6A5NDQ.mjs.map} +0 -0
- /package/dist/lib/neutral/{create-JK35XC4R.mjs.map → create-OQUMKL5I.mjs.map} +0 -0
- /package/dist/lib/neutral/{create-markdown-7MLE625M.mjs.map → create-markdown-4O5FDA77.mjs.map} +0 -0
- /package/dist/lib/neutral/{open-5YC77C4O.mjs.map → open-BAZIRXII.mjs.map} +0 -0
- /package/dist/lib/neutral/{blueprints/index.mjs.map → operation-handler-SDCXGMGK.mjs.map} +0 -0
- /package/dist/lib/neutral/{scroll-to-anchor-GAFB7W55.mjs.map → scroll-to-anchor-I6HFE5AH.mjs.map} +0 -0
- /package/dist/lib/neutral/{set-view-mode-N7UHYMPG.mjs.map → set-view-mode-NY5OYYIM.mjs.map} +0 -0
- /package/dist/types/src/{components → containers}/MarkdownSettings/MarkdownSettings.stories.d.ts +0 -0
- /package/dist/types/src/{components → containers}/MarkdownSettings/index.d.ts +0 -0
- /package/src/{components → containers}/MarkdownSettings/index.ts +0 -0
package/dx.config.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Config2 } from '@dxos/app-framework/config';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
7
|
+
|
|
8
|
+
export default Config2.make({
|
|
9
|
+
plugin: {
|
|
10
|
+
key: 'org.dxos.plugin.markdown',
|
|
11
|
+
name: 'Markdown',
|
|
12
|
+
author: 'DXOS',
|
|
13
|
+
description: trim`
|
|
14
|
+
A full-featured markdown editor for authoring documents in your space. Edits flow through a collaborative CodeMirror surface backed by ECHO Text, so every keystroke replicates to other peers in real time without merge conflicts or lost work.
|
|
15
|
+
|
|
16
|
+
Documents can be opened in source, preview, or read-only mode and rendered as a full-surface article or as embeddable cards. An optional formatting toolbar exposes headings, lists, links, and other common markdown actions, and dispositional toolbar actions contributed by other plugins are surfaced inline alongside it.
|
|
17
|
+
|
|
18
|
+
The editor integrates with the rest of the workspace through @ references that link to any ECHO object, image and file uploads stored in the active space, and anchored comment threads on text ranges. Comments can optionally be routed to an AI agent on every message or only on @mention.
|
|
19
|
+
|
|
20
|
+
A built-in skill exposes create, open, and update operations as tools for AI agents. Updates are applied as compact find-and-replace diffs against the document, making it safe for agents to edit large documents incrementally while you continue collaborating.
|
|
21
|
+
`,
|
|
22
|
+
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-markdown',
|
|
23
|
+
icon: { key: 'ph--text-aa--regular', hue: 'indigo' },
|
|
24
|
+
screenshots: [
|
|
25
|
+
{
|
|
26
|
+
dark: 'https://customer-5rxcjpyab08avpmn.cloudflarestream.com/cdf2656365bb1fd327c1fc2105d75e5a/iframe?poster=https%3A%2F%2Fcustomer-5rxcjpyab08avpmn.cloudflarestream.com%2Fcdf2656365bb1fd327c1fc2105d75e5a%2Fthumbnails%2Fthumbnail.jpg%3Ftime%3D%26height%3D600',
|
|
27
|
+
},
|
|
28
|
+
{ dark: 'https://dxos.network/plugin-details-markdown-dark.png' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-markdown",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1-staging.ee54ba693a",
|
|
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",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"sideEffects": true,
|
|
14
14
|
"type": "module",
|
|
15
15
|
"imports": {
|
|
16
|
-
"#
|
|
17
|
-
"source": "./src/
|
|
18
|
-
"types": "./dist/types/src/
|
|
19
|
-
"default": "./dist/lib/neutral/
|
|
16
|
+
"#skills": {
|
|
17
|
+
"source": "./src/skills/index.ts",
|
|
18
|
+
"types": "./dist/types/src/skills/index.d.ts",
|
|
19
|
+
"default": "./dist/lib/neutral/skills/index.mjs"
|
|
20
20
|
},
|
|
21
21
|
"#capabilities": {
|
|
22
22
|
"source": {
|
|
@@ -85,14 +85,18 @@
|
|
|
85
85
|
"types": "./dist/types/src/index.d.ts",
|
|
86
86
|
"default": "./dist/lib/neutral/index.mjs"
|
|
87
87
|
},
|
|
88
|
-
"./
|
|
89
|
-
"source": "./src/
|
|
90
|
-
"types": "./dist/types/src/
|
|
91
|
-
"default": "./dist/lib/neutral/
|
|
88
|
+
"./skills": {
|
|
89
|
+
"source": "./src/skills/index.ts",
|
|
90
|
+
"types": "./dist/types/src/skills/index.d.ts",
|
|
91
|
+
"default": "./dist/lib/neutral/skills/index.mjs"
|
|
92
92
|
},
|
|
93
93
|
"./plugin": {
|
|
94
|
-
"source":
|
|
94
|
+
"source": {
|
|
95
|
+
"workerd": "./src/plugin.workerd.ts",
|
|
96
|
+
"default": "./src/plugin.ts"
|
|
97
|
+
},
|
|
95
98
|
"types": "./dist/types/src/plugin.d.ts",
|
|
99
|
+
"workerd": "./dist/lib/neutral/plugin.workerd.mjs",
|
|
96
100
|
"default": "./dist/lib/neutral/plugin.mjs"
|
|
97
101
|
},
|
|
98
102
|
"./testing": {
|
|
@@ -114,10 +118,11 @@
|
|
|
114
118
|
"types": "dist/types/src/index.d.ts",
|
|
115
119
|
"files": [
|
|
116
120
|
"dist",
|
|
121
|
+
"dx.config.ts",
|
|
117
122
|
"src"
|
|
118
123
|
],
|
|
119
124
|
"dependencies": {
|
|
120
|
-
"@automerge/automerge": "3.3.0-fragments.
|
|
125
|
+
"@automerge/automerge": "3.3.0-fragments.2",
|
|
121
126
|
"@codemirror/state": "^6.6.0",
|
|
122
127
|
"@codemirror/view": "^6.43.0",
|
|
123
128
|
"@effect-atom/atom-react": "^0.5.0",
|
|
@@ -125,62 +130,65 @@
|
|
|
125
130
|
"@effect/experimental": "0.60.0",
|
|
126
131
|
"@radix-ui/react-context": "1.1.1",
|
|
127
132
|
"react-dropzone": "^14.2.3",
|
|
128
|
-
"@dxos/ai": "0.9.
|
|
129
|
-
"@dxos/app-framework": "0.9.
|
|
130
|
-
"@dxos/
|
|
131
|
-
"@dxos/
|
|
132
|
-
"@dxos/
|
|
133
|
-
"@dxos/
|
|
134
|
-
"@dxos/client
|
|
135
|
-
"@dxos/
|
|
136
|
-
"@dxos/echo": "0.9.
|
|
137
|
-
"@dxos/
|
|
138
|
-
"@dxos/
|
|
139
|
-
"@dxos/functions-runtime": "0.9.
|
|
140
|
-
"@dxos/
|
|
141
|
-
"@dxos/
|
|
142
|
-
"@dxos/
|
|
143
|
-
"@dxos/plugin-client": "0.9.
|
|
144
|
-
"@dxos/plugin-
|
|
145
|
-
"@dxos/
|
|
146
|
-
"@dxos/plugin-preview": "0.9.
|
|
147
|
-
"@dxos/plugin-
|
|
148
|
-
"@dxos/
|
|
149
|
-
"@dxos/react-
|
|
150
|
-
"@dxos/react-ui-
|
|
151
|
-
"@dxos/react-
|
|
152
|
-
"@dxos/react-ui-
|
|
153
|
-
"@dxos/
|
|
154
|
-
"@dxos/
|
|
155
|
-
"@dxos/
|
|
156
|
-
"@dxos/
|
|
157
|
-
"@dxos/
|
|
133
|
+
"@dxos/ai": "0.9.1-staging.ee54ba693a",
|
|
134
|
+
"@dxos/app-framework": "0.9.1-staging.ee54ba693a",
|
|
135
|
+
"@dxos/app-toolkit": "0.9.1-staging.ee54ba693a",
|
|
136
|
+
"@dxos/assistant": "0.9.1-staging.ee54ba693a",
|
|
137
|
+
"@dxos/async": "0.9.1-staging.ee54ba693a",
|
|
138
|
+
"@dxos/echo": "0.9.1-staging.ee54ba693a",
|
|
139
|
+
"@dxos/client": "0.9.1-staging.ee54ba693a",
|
|
140
|
+
"@dxos/client-protocol": "0.9.1-staging.ee54ba693a",
|
|
141
|
+
"@dxos/echo-client": "0.9.1-staging.ee54ba693a",
|
|
142
|
+
"@dxos/invariant": "0.9.1-staging.ee54ba693a",
|
|
143
|
+
"@dxos/echo-doc": "0.9.1-staging.ee54ba693a",
|
|
144
|
+
"@dxos/functions-runtime": "0.9.1-staging.ee54ba693a",
|
|
145
|
+
"@dxos/effect": "0.9.1-staging.ee54ba693a",
|
|
146
|
+
"@dxos/log": "0.9.1-staging.ee54ba693a",
|
|
147
|
+
"@dxos/plugin-attention": "0.9.1-staging.ee54ba693a",
|
|
148
|
+
"@dxos/plugin-client": "0.9.1-staging.ee54ba693a",
|
|
149
|
+
"@dxos/plugin-graph": "0.9.1-staging.ee54ba693a",
|
|
150
|
+
"@dxos/keys": "0.9.1-staging.ee54ba693a",
|
|
151
|
+
"@dxos/plugin-preview": "0.9.1-staging.ee54ba693a",
|
|
152
|
+
"@dxos/plugin-sketch": "0.9.1-staging.ee54ba693a",
|
|
153
|
+
"@dxos/plugin-space": "0.9.1-staging.ee54ba693a",
|
|
154
|
+
"@dxos/react-ui-attention": "0.9.1-staging.ee54ba693a",
|
|
155
|
+
"@dxos/react-ui-dnd": "0.9.1-staging.ee54ba693a",
|
|
156
|
+
"@dxos/react-client": "0.9.1-staging.ee54ba693a",
|
|
157
|
+
"@dxos/react-ui-editor": "0.9.1-staging.ee54ba693a",
|
|
158
|
+
"@dxos/react-ui-mosaic": "0.9.1-staging.ee54ba693a",
|
|
159
|
+
"@dxos/react-ui-form": "0.9.1-staging.ee54ba693a",
|
|
160
|
+
"@dxos/compute": "0.9.1-staging.ee54ba693a",
|
|
161
|
+
"@dxos/types": "0.9.1-staging.ee54ba693a",
|
|
162
|
+
"@dxos/ui-editor": "0.9.1-staging.ee54ba693a",
|
|
163
|
+
"@dxos/ui": "0.9.1-staging.ee54ba693a",
|
|
164
|
+
"@dxos/util": "0.9.1-staging.ee54ba693a",
|
|
165
|
+
"@dxos/schema": "0.9.1-staging.ee54ba693a"
|
|
158
166
|
},
|
|
159
167
|
"devDependencies": {
|
|
160
168
|
"@effect-atom/atom-react": "^0.5.0",
|
|
161
|
-
"@effect/platform": "0.96.
|
|
162
|
-
"@types/react": "~19.2.
|
|
169
|
+
"@effect/platform": "0.96.2",
|
|
170
|
+
"@types/react": "~19.2.17",
|
|
163
171
|
"@types/react-dom": "~19.2.3",
|
|
164
|
-
"effect": "3.21.
|
|
165
|
-
"react": "~19.2.
|
|
166
|
-
"react-dom": "~19.2.
|
|
172
|
+
"effect": "3.21.4",
|
|
173
|
+
"react": "~19.2.7",
|
|
174
|
+
"react-dom": "~19.2.7",
|
|
167
175
|
"vite": "^8.0.16",
|
|
168
|
-
"@dxos/debug": "0.9.
|
|
169
|
-
"@dxos/plugin-
|
|
170
|
-
"@dxos/plugin-
|
|
171
|
-
"@dxos/
|
|
172
|
-
"@dxos/
|
|
173
|
-
"@dxos/
|
|
174
|
-
"@dxos/
|
|
176
|
+
"@dxos/debug": "0.9.1-staging.ee54ba693a",
|
|
177
|
+
"@dxos/plugin-testing": "0.9.1-staging.ee54ba693a",
|
|
178
|
+
"@dxos/plugin-theme": "0.9.1-staging.ee54ba693a",
|
|
179
|
+
"@dxos/random": "0.9.1-staging.ee54ba693a",
|
|
180
|
+
"@dxos/react-ui": "0.9.1-staging.ee54ba693a",
|
|
181
|
+
"@dxos/storybook-utils": "0.9.1-staging.ee54ba693a",
|
|
182
|
+
"@dxos/ui-theme": "0.9.1-staging.ee54ba693a"
|
|
175
183
|
},
|
|
176
184
|
"peerDependencies": {
|
|
177
185
|
"@effect-atom/atom-react": "^0.5.0",
|
|
178
|
-
"@effect/platform": "0.96.
|
|
179
|
-
"effect": "3.21.
|
|
180
|
-
"react": "~19.2.
|
|
181
|
-
"react-dom": "~19.2.
|
|
182
|
-
"@dxos/
|
|
183
|
-
"@dxos/ui
|
|
186
|
+
"@effect/platform": "0.96.2",
|
|
187
|
+
"effect": "3.21.4",
|
|
188
|
+
"react": "~19.2.7",
|
|
189
|
+
"react-dom": "~19.2.7",
|
|
190
|
+
"@dxos/ui-theme": "0.9.1-staging.ee54ba693a",
|
|
191
|
+
"@dxos/react-ui": "0.9.1-staging.ee54ba693a"
|
|
184
192
|
},
|
|
185
193
|
"publishConfig": {
|
|
186
194
|
"access": "public"
|
|
@@ -6,11 +6,12 @@ import { Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { AppPlugin } from '@dxos/app-toolkit';
|
|
7
7
|
import { Text } from '@dxos/schema';
|
|
8
8
|
|
|
9
|
-
import { CreateObject, OperationHandler } from '#capabilities';
|
|
9
|
+
import { CreateObject, OperationHandler, SkillDefinition } from '#capabilities';
|
|
10
10
|
import { meta } from '#meta';
|
|
11
11
|
import { Markdown } from '#types';
|
|
12
12
|
|
|
13
13
|
export const MarkdownPlugin = Plugin.define(meta).pipe(
|
|
14
|
+
AppPlugin.addSkillDefinitionModule({ activate: SkillDefinition }),
|
|
14
15
|
AppPlugin.addCreateObjectModule({ activate: CreateObject }),
|
|
15
16
|
AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
|
|
16
17
|
AppPlugin.addSchemaModule({ schema: [Markdown.Document, Text.Text] }),
|
|
@@ -11,7 +11,7 @@ import { MarkdownPlugin } from '#plugin';
|
|
|
11
11
|
|
|
12
12
|
import { meta } from './meta';
|
|
13
13
|
|
|
14
|
-
const moduleId = (name: string) => `${meta.
|
|
14
|
+
const moduleId = (name: string) => `${meta.profile.key}.module.${name}`;
|
|
15
15
|
|
|
16
16
|
describe('MarkdownPlugin', () => {
|
|
17
17
|
test('modules activate on the expected events', async ({ expect }) => {
|
package/src/MarkdownPlugin.tsx
CHANGED
|
@@ -2,32 +2,28 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Plugin } from '@dxos/app-framework';
|
|
5
|
+
import { ActivationEvent, Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { AppActivationEvents, AppPlugin } from '@dxos/app-toolkit';
|
|
7
|
+
import { AttentionEvents } from '@dxos/plugin-attention';
|
|
7
8
|
import { translations as editorTranslations } from '@dxos/react-ui-editor/translations';
|
|
8
9
|
import { Text } from '@dxos/schema';
|
|
9
10
|
|
|
10
11
|
import {
|
|
11
12
|
AnchorSort,
|
|
12
|
-
AppGraphBuilder,
|
|
13
|
-
NavigationResolver,
|
|
14
|
-
AppGraphSerializer,
|
|
15
|
-
BlueprintDefinition,
|
|
16
13
|
CommentConfig,
|
|
17
14
|
CreateObject,
|
|
18
15
|
MarkdownSettings,
|
|
19
16
|
MarkdownState,
|
|
20
17
|
OperationHandler,
|
|
21
18
|
ReactSurface,
|
|
19
|
+
SkillDefinition,
|
|
22
20
|
} from '#capabilities';
|
|
23
21
|
import { meta } from '#meta';
|
|
24
22
|
import { translations } from '#translations';
|
|
25
23
|
import { Markdown, MarkdownEvents } from '#types';
|
|
26
24
|
|
|
27
25
|
export const MarkdownPlugin = Plugin.define(meta).pipe(
|
|
28
|
-
AppPlugin.
|
|
29
|
-
AppPlugin.addNavigationResolverModule({ activate: NavigationResolver }),
|
|
30
|
-
AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),
|
|
26
|
+
AppPlugin.addSkillDefinitionModule({ activate: SkillDefinition }),
|
|
31
27
|
AppPlugin.addCommentConfigModule({ activate: CommentConfig }),
|
|
32
28
|
AppPlugin.addCreateObjectModule({ activate: CreateObject }),
|
|
33
29
|
AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
|
|
@@ -43,16 +39,11 @@ export const MarkdownPlugin = Plugin.define(meta).pipe(
|
|
|
43
39
|
}),
|
|
44
40
|
Plugin.addModule({
|
|
45
41
|
id: 'state',
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
activatesOn: AppActivationEvents.SetupSettings,
|
|
42
|
+
// Wait for AttentionEvents.AttentionReady so ViewStateManager is available when the module
|
|
43
|
+
// resolves AttentionCapabilities.ViewState to build the editor state store.
|
|
44
|
+
activatesOn: ActivationEvent.allOf(AppActivationEvents.SetupSettings, AttentionEvents.AttentionReady),
|
|
50
45
|
activate: MarkdownState,
|
|
51
46
|
}),
|
|
52
|
-
Plugin.addModule({
|
|
53
|
-
activatesOn: AppActivationEvents.AppGraphReady,
|
|
54
|
-
activate: AppGraphSerializer,
|
|
55
|
-
}),
|
|
56
47
|
Plugin.addModule({
|
|
57
48
|
// TODO(wittjosiah): More relevant event?
|
|
58
49
|
activatesOn: AppActivationEvents.AppGraphReady,
|
|
@@ -6,12 +6,15 @@ import { Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { AppPlugin } from '@dxos/app-toolkit';
|
|
7
7
|
import { Text } from '@dxos/schema';
|
|
8
8
|
|
|
9
|
-
import { OperationHandler } from '#capabilities';
|
|
10
9
|
import { meta } from '#meta';
|
|
11
10
|
import { Markdown } from '#types';
|
|
12
11
|
|
|
12
|
+
import OperationHandler from './capabilities/operation-handler';
|
|
13
|
+
import SkillDefinition from './capabilities/skill-definition';
|
|
14
|
+
|
|
13
15
|
export const MarkdownPlugin = Plugin.define(meta).pipe(
|
|
14
|
-
AppPlugin.
|
|
16
|
+
AppPlugin.addSkillDefinitionModule({ id: 'skill-definition', activate: SkillDefinition }),
|
|
17
|
+
AppPlugin.addOperationHandlerModule({ id: 'operation-handler', activate: OperationHandler }),
|
|
15
18
|
AppPlugin.addSchemaModule({ schema: [Markdown.Document, Text.Text] }),
|
|
16
19
|
Plugin.make,
|
|
17
20
|
);
|
|
@@ -7,7 +7,8 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import { Capability } from '@dxos/app-framework';
|
|
8
8
|
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
9
|
import { Relation, Type } from '@dxos/echo';
|
|
10
|
-
import {
|
|
10
|
+
import { getRangeFromCursor } from '@dxos/echo-client';
|
|
11
|
+
import { Doc } from '@dxos/echo-doc';
|
|
11
12
|
import { type AnchoredTo } from '@dxos/types';
|
|
12
13
|
|
|
13
14
|
import { Markdown } from '#types';
|
|
@@ -18,7 +19,7 @@ export default Capability.makeModule(() =>
|
|
|
18
19
|
key: Type.getTypename(Markdown.Document),
|
|
19
20
|
sort: (anchorA: AnchoredTo.AnchoredTo, anchorB: AnchoredTo.AnchoredTo) => {
|
|
20
21
|
const doc = Relation.getTarget(anchorA) as Markdown.Document;
|
|
21
|
-
const accessor = doc.content.target ?
|
|
22
|
+
const accessor = doc.content.target ? Doc.createAccessor(doc.content.target, ['content']) : undefined;
|
|
22
23
|
if (doc !== Relation.getTarget(anchorB) || !accessor) {
|
|
23
24
|
return 0;
|
|
24
25
|
}
|
|
@@ -7,25 +7,22 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import { Capability } from '@dxos/app-framework';
|
|
8
8
|
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
9
|
import { Type } from '@dxos/echo';
|
|
10
|
-
import {
|
|
10
|
+
import { getTextInRange } from '@dxos/echo-client';
|
|
11
|
+
import { Doc } from '@dxos/echo-doc';
|
|
11
12
|
|
|
12
13
|
import { MarkdownOperation } from '#types';
|
|
13
14
|
import { Markdown } from '#types';
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
const activate: () => Effect.Effect<
|
|
17
|
-
Capability.Capability<typeof AppCapabilities.CommentConfig>,
|
|
18
|
-
never,
|
|
19
|
-
Capability.Service
|
|
20
|
-
> = Effect.fnUntraced(function* () {
|
|
16
|
+
const activate = Effect.fnUntraced(function* () {
|
|
21
17
|
const config: AppCapabilities.CommentConfig = {
|
|
22
18
|
id: Type.getTypename(Markdown.Document),
|
|
23
19
|
comments: 'anchored',
|
|
24
20
|
selectionMode: 'multi-range',
|
|
25
21
|
getAnchorLabel: (doc: Markdown.Document, anchor: string): string | undefined => {
|
|
26
|
-
|
|
22
|
+
const target = doc.content?.target;
|
|
23
|
+
if (target) {
|
|
27
24
|
const [start, end] = anchor.split(':');
|
|
28
|
-
return getTextInRange(
|
|
25
|
+
return getTextInRange(Doc.createAccessor(target, ['content']), start, end);
|
|
29
26
|
}
|
|
30
27
|
},
|
|
31
28
|
scrollToAnchor: MarkdownOperation.ScrollToAnchor,
|
|
@@ -12,8 +12,6 @@ import { SpaceCapabilities } from '@dxos/plugin-space';
|
|
|
12
12
|
|
|
13
13
|
import { Markdown } from '#types';
|
|
14
14
|
|
|
15
|
-
import { getDocumentsPath } from '../paths';
|
|
16
|
-
|
|
17
15
|
export default Capability.makeModule(
|
|
18
16
|
Effect.fnUntraced(function* () {
|
|
19
17
|
return Capability.contributes(SpaceCapabilities.CreateObjectEntry, {
|
|
@@ -24,8 +22,7 @@ export default Capability.makeModule(
|
|
|
24
22
|
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
25
23
|
object,
|
|
26
24
|
target: options.target,
|
|
27
|
-
|
|
28
|
-
targetNodeId: options.targetNodeId ?? getDocumentsPath(options.db.spaceId),
|
|
25
|
+
targetNodeId: options.targetNodeId,
|
|
29
26
|
});
|
|
30
27
|
}),
|
|
31
28
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { invariant } from '@dxos/invariant';
|
|
6
|
+
import { type ViewStateManager, defineViewState } from '@dxos/react-ui-attention';
|
|
7
|
+
import { EditorSelectionStateSchema, type EditorStateStore } from '@dxos/ui-editor';
|
|
8
|
+
|
|
9
|
+
/** Per-document editor scroll/caret state, persisted to localStorage on this device. */
|
|
10
|
+
export const editorViewStateAspect = defineViewState({
|
|
11
|
+
key: 'editor',
|
|
12
|
+
backend: 'local',
|
|
13
|
+
schema: EditorSelectionStateSchema,
|
|
14
|
+
defaultValue: () => ({}),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/** Adapts the imperative editor store seam onto the ViewState manager (local backend). */
|
|
18
|
+
export const createEditorViewStateStore = (manager: ViewStateManager): EditorStateStore => ({
|
|
19
|
+
getState: (id) => {
|
|
20
|
+
// Guard against an unset document id, which would key state under a literal "undefined".
|
|
21
|
+
invariant(id);
|
|
22
|
+
return manager.get(editorViewStateAspect, id);
|
|
23
|
+
},
|
|
24
|
+
setState: (id, state) => {
|
|
25
|
+
invariant(id);
|
|
26
|
+
manager.set(editorViewStateAspect, id, state);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
@@ -3,26 +3,12 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Capability } from '@dxos/app-framework';
|
|
6
|
-
import { type AppCapabilities } from '@dxos/app-toolkit';
|
|
7
6
|
import type { OperationHandlerSet } from '@dxos/compute';
|
|
8
7
|
|
|
9
|
-
export const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));
|
|
10
|
-
export const NavigationResolver = Capability.lazy('NavigationResolver', () => import('./navigation-resolver'));
|
|
11
8
|
export const AnchorSort = Capability.lazy('AnchorSort', () => import('./anchor-sort'));
|
|
12
|
-
export const
|
|
13
|
-
// The contributed capability type references Operation types from @dxos/compute, so the lazy
|
|
14
|
-
// wrapper needs an explicit annotation to keep the inferred type portable (TS2883).
|
|
15
|
-
export const CommentConfig: Capability.LazyCapability<
|
|
16
|
-
void,
|
|
17
|
-
Capability.Capability<typeof AppCapabilities.CommentConfig>
|
|
18
|
-
> = Capability.lazy('CommentConfig', () => import('./comment-config'));
|
|
9
|
+
export const CommentConfig = Capability.lazy('CommentConfig', () => import('./comment-config'));
|
|
19
10
|
export const CreateObject = Capability.lazy('CreateObject', () => import('./create-object'));
|
|
20
|
-
|
|
21
|
-
// wrapper needs an explicit annotation to keep the inferred type portable (TS2883).
|
|
22
|
-
export const BlueprintDefinition: Capability.LazyCapability<
|
|
23
|
-
void,
|
|
24
|
-
Capability.Capability<typeof AppCapabilities.BlueprintDefinition>[]
|
|
25
|
-
> = Capability.lazy('BlueprintDefinition', () => import('./blueprint-definition'));
|
|
11
|
+
export const SkillDefinition = Capability.lazy('SkillDefinition', () => import('./skill-definition'));
|
|
26
12
|
export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
|
|
27
13
|
'OperationHandler',
|
|
28
14
|
() => import('./operation-handler'),
|
package/src/capabilities/node.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { Capability } from '@dxos/app-framework';
|
|
6
6
|
import { OperationHandlerSet } from '@dxos/compute';
|
|
7
7
|
|
|
8
|
+
export const SkillDefinition = Capability.lazy('SkillDefinition', () => import('./skill-definition'));
|
|
8
9
|
export const CreateObject = Capability.lazy('CreateObject', () => import('./create-object'));
|
|
9
10
|
|
|
10
11
|
export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
|
|
@@ -19,9 +19,15 @@ import { Obj } from '@dxos/echo';
|
|
|
19
19
|
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
20
20
|
import { Text } from '@dxos/schema';
|
|
21
21
|
import { type EditorViewMode } from '@dxos/ui-editor/types';
|
|
22
|
+
import { Position } from '@dxos/util';
|
|
22
23
|
|
|
23
|
-
import {
|
|
24
|
-
|
|
24
|
+
import {
|
|
25
|
+
EditableMarkdownCard,
|
|
26
|
+
MarkdownArticle,
|
|
27
|
+
type MarkdownArticleProps,
|
|
28
|
+
MarkdownCard,
|
|
29
|
+
MarkdownSettings,
|
|
30
|
+
} from '#containers';
|
|
25
31
|
import { meta } from '#meta';
|
|
26
32
|
import { Markdown, MarkdownCapabilities } from '#types';
|
|
27
33
|
|
|
@@ -31,9 +37,11 @@ export default Capability.makeModule(() =>
|
|
|
31
37
|
Surface.create({
|
|
32
38
|
id: 'surface.document',
|
|
33
39
|
// TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
filter: AppSurface.oneOf(
|
|
41
|
+
AppSurface.object(AppSurface.Article, Markdown.Document, (data) => !data.variant),
|
|
42
|
+
AppSurface.object(AppSurface.Section, Markdown.Document),
|
|
43
|
+
AppSurface.object(AppSurface.Tabpanel, Markdown.Document, (data) => !data.variant),
|
|
44
|
+
),
|
|
37
45
|
component: ({ data, role, ref }) => {
|
|
38
46
|
return (
|
|
39
47
|
<Container
|
|
@@ -41,7 +49,7 @@ export default Capability.makeModule(() =>
|
|
|
41
49
|
attendableId={data.attendableId}
|
|
42
50
|
subject={data.subject}
|
|
43
51
|
role={role}
|
|
44
|
-
ref={ref}
|
|
52
|
+
ref={ref as React.Ref<HTMLDivElement>}
|
|
45
53
|
/>
|
|
46
54
|
);
|
|
47
55
|
},
|
|
@@ -62,14 +70,14 @@ export default Capability.makeModule(() =>
|
|
|
62
70
|
attendableId={data.attendableId}
|
|
63
71
|
subject={data.subject}
|
|
64
72
|
role={role}
|
|
65
|
-
ref={ref}
|
|
73
|
+
ref={ref as React.Ref<HTMLDivElement>}
|
|
66
74
|
/>
|
|
67
75
|
);
|
|
68
76
|
},
|
|
69
77
|
}),
|
|
70
78
|
Surface.create({
|
|
71
79
|
id: 'surface.pluginSettings',
|
|
72
|
-
filter: AppSurface.settings(AppSurface.Article, meta.
|
|
80
|
+
filter: AppSurface.settings(AppSurface.Article, meta.profile.key),
|
|
73
81
|
component: ({ data: { subject } }) => {
|
|
74
82
|
const { settings, updateSettings } = useSettingsState<Markdown.Settings>(subject.atom);
|
|
75
83
|
return <MarkdownSettings settings={settings} onSettingsChange={updateSettings} />;
|
|
@@ -77,13 +85,21 @@ export default Capability.makeModule(() =>
|
|
|
77
85
|
}),
|
|
78
86
|
Surface.create({
|
|
79
87
|
id: 'surface.editable',
|
|
80
|
-
position:
|
|
81
|
-
filter: AppSurface.object(
|
|
88
|
+
position: Position.first,
|
|
89
|
+
filter: AppSurface.object(
|
|
90
|
+
AppSurface.CardContent,
|
|
91
|
+
[Markdown.Document, Text.Text],
|
|
92
|
+
(data) => data.editable === true,
|
|
93
|
+
),
|
|
82
94
|
component: ({ data }) => <EditableMarkdownCard subject={data.subject} />,
|
|
83
95
|
}),
|
|
84
96
|
Surface.create({
|
|
85
97
|
id: 'surface.preview',
|
|
86
|
-
filter: AppSurface.object(
|
|
98
|
+
filter: AppSurface.object(
|
|
99
|
+
AppSurface.CardContent,
|
|
100
|
+
[Markdown.Document, Text.Text],
|
|
101
|
+
(data) => data.editable !== true,
|
|
102
|
+
),
|
|
87
103
|
component: ({ data }) => <MarkdownCard {...data} />,
|
|
88
104
|
}),
|
|
89
105
|
]),
|
|
@@ -97,7 +113,7 @@ const Container = forwardRef<
|
|
|
97
113
|
HTMLDivElement,
|
|
98
114
|
AppSurface.ObjectArticleProps<Markdown.Document | Text.Text, { id: string }>
|
|
99
115
|
>(({ id, attendableId, subject, role }, forwardedRef) => {
|
|
100
|
-
const
|
|
116
|
+
const viewState = useCapability(AttentionCapabilities.ViewState);
|
|
101
117
|
const settings = useAtomCapability(MarkdownCapabilities.Settings);
|
|
102
118
|
const [state, setState] = useAtomCapabilityState(MarkdownCapabilities.State);
|
|
103
119
|
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
@@ -117,7 +133,7 @@ const Container = forwardRef<
|
|
|
117
133
|
id={id}
|
|
118
134
|
attendableId={attendableId}
|
|
119
135
|
settings={settings}
|
|
120
|
-
|
|
136
|
+
viewState={viewState}
|
|
121
137
|
extensionProviders={extensionProviders}
|
|
122
138
|
editorStateStore={editorState}
|
|
123
139
|
viewMode={viewMode}
|
|
@@ -14,7 +14,7 @@ import { Markdown, MarkdownCapabilities } from '#types';
|
|
|
14
14
|
export default Capability.makeModule(() =>
|
|
15
15
|
Effect.sync(() => {
|
|
16
16
|
const settingsAtom = createKvsStore({
|
|
17
|
-
key: meta.
|
|
17
|
+
key: meta.profile.key,
|
|
18
18
|
schema: Markdown.Settings,
|
|
19
19
|
defaultValue: () => ({
|
|
20
20
|
defaultViewMode: 'preview' as const,
|
|
@@ -28,7 +28,7 @@ export default Capability.makeModule(() =>
|
|
|
28
28
|
return [
|
|
29
29
|
Capability.contributes(MarkdownCapabilities.Settings, settingsAtom),
|
|
30
30
|
Capability.contributes(AppCapabilities.Settings, {
|
|
31
|
-
prefix: meta.
|
|
31
|
+
prefix: meta.profile.key,
|
|
32
32
|
schema: Markdown.Settings,
|
|
33
33
|
atom: settingsAtom,
|
|
34
34
|
}),
|
|
@@ -0,0 +1,14 @@
|
|
|
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 { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
|
|
10
|
+
import { MarkdownSkill } from '#skills';
|
|
11
|
+
|
|
12
|
+
const skillDefinition = () => Effect.succeed([Capability.contributes(AppCapabilities.SkillDefinition, MarkdownSkill)]);
|
|
13
|
+
|
|
14
|
+
export default skillDefinition;
|
|
@@ -6,11 +6,13 @@ import * as Effect from 'effect/Effect';
|
|
|
6
6
|
|
|
7
7
|
import { Capability } from '@dxos/app-framework';
|
|
8
8
|
import { createKvsStore } from '@dxos/effect';
|
|
9
|
-
import {
|
|
9
|
+
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
10
10
|
|
|
11
11
|
import { meta } from '#meta';
|
|
12
12
|
import { MarkdownCapabilities } from '#types';
|
|
13
13
|
|
|
14
|
+
import { createEditorViewStateStore } from './editor-view-state';
|
|
15
|
+
|
|
14
16
|
const createEditorViewRegistry = (): MarkdownCapabilities.EditorViewRegistry => {
|
|
15
17
|
const views = new Map<string, MarkdownCapabilities.EditorViewEntry>();
|
|
16
18
|
return {
|
|
@@ -28,13 +30,15 @@ export default Capability.makeModule(
|
|
|
28
30
|
Effect.fnUntraced(function* () {
|
|
29
31
|
// Persisted state using KVS store.
|
|
30
32
|
const stateAtom = createKvsStore({
|
|
31
|
-
key: `${meta.
|
|
33
|
+
key: `${meta.profile.key}.state`,
|
|
32
34
|
schema: MarkdownCapabilities.StateSchema,
|
|
33
35
|
defaultValue: () => ({ viewMode: {} }),
|
|
34
36
|
});
|
|
35
37
|
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
+
// Resolve ViewStateManager contributed by plugin-attention (guaranteed available because this
|
|
39
|
+
// module activates only after AttentionEvents.AttentionReady fires — see MarkdownPlugin.tsx).
|
|
40
|
+
const viewState = yield* Capability.get(AttentionCapabilities.ViewState);
|
|
41
|
+
const editorState = createEditorViewStateStore(viewState);
|
|
38
42
|
|
|
39
43
|
const editorViews = createEditorViewRegistry();
|
|
40
44
|
|
|
@@ -7,7 +7,7 @@ import React, { forwardRef, useEffect, useImperativeHandle } from 'react';
|
|
|
7
7
|
import { createPortal } from 'react-dom';
|
|
8
8
|
import { useDropzone } from 'react-dropzone';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
11
11
|
import { addLink } from '@dxos/ui-editor';
|
|
12
12
|
|
|
13
13
|
export const IMAGE_FILES = ['.jpg', '.jpeg', '.png', '.gif'];
|
|
@@ -19,7 +19,7 @@ export type FileUploadProps = {
|
|
|
19
19
|
// that React 19.2's dev render-logger would walk into a cross-origin frame. See
|
|
20
20
|
// `react-ui-editor/.../controller.ts` for the full rationale.
|
|
21
21
|
getView?: () => EditorView | null;
|
|
22
|
-
onFileUpload?: (file: File) => Promise<FileInfo | undefined>;
|
|
22
|
+
onFileUpload?: (file: File) => Promise<AppCapabilities.FileInfo | undefined>;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
// TODO(burdon): Factor out.
|