@dxos/plugin-markdown 0.8.4-staging.60fe92afc8 → 0.9.1-main.c7dcc2e112
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-I4UMD7AA.mjs} +3 -3
- package/dist/lib/neutral/MarkdownArticle-I4UMD7AA.mjs.map +7 -0
- package/dist/lib/neutral/{MarkdownCard-TBLIRDBO.mjs → MarkdownCard-OYO2HYZF.mjs} +2 -2
- package/dist/lib/neutral/MarkdownCard-OYO2HYZF.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownPlugin.mjs +6 -9
- package/dist/lib/neutral/MarkdownPlugin.mjs.map +3 -3
- package/dist/lib/neutral/{MarkdownSettings-YCTZJL5V.mjs → MarkdownSettings-F5AWRDT3.mjs} +2 -2
- package/dist/lib/neutral/{MarkdownSettings-YCTZJL5V.mjs.map → MarkdownSettings-F5AWRDT3.mjs.map} +3 -3
- package/dist/lib/neutral/{app-graph-builder-BWBA23FF.mjs → app-graph-builder-6Y5NHTNR.mjs} +3 -4
- package/dist/lib/neutral/app-graph-builder-6Y5NHTNR.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +6 -8
- package/dist/lib/neutral/capabilities/index.mjs.map +3 -3
- package/dist/lib/neutral/capabilities/node.mjs +1 -1
- package/dist/lib/neutral/{chunk-67DKWOKF.mjs → chunk-4ULSRZRL.mjs} +3 -3
- package/dist/lib/neutral/chunk-4ULSRZRL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BL46CERY.mjs +8 -0
- package/dist/lib/neutral/{chunk-Y2LQRUU7.mjs → chunk-CRKAIDRD.mjs} +11 -11
- package/dist/lib/neutral/chunk-CRKAIDRD.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GUXWFDD4.mjs +43 -0
- package/dist/lib/neutral/chunk-GUXWFDD4.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +9 -8
- package/dist/lib/neutral/components/index.mjs.map +3 -3
- package/dist/lib/neutral/containers/index.mjs +2 -2
- package/dist/lib/neutral/{create-JK35XC4R.mjs → create-XW2FQNLK.mjs} +2 -2
- package/dist/lib/neutral/{create-markdown-7MLE625M.mjs → create-markdown-KLSVQCT7.mjs} +2 -2
- package/dist/lib/neutral/{create-object-MU2LGXG6.mjs → create-object-3WMEQJ2C.mjs} +2 -2
- package/dist/lib/neutral/hooks/index.mjs +16 -12
- package/dist/lib/neutral/hooks/index.mjs.map +3 -3
- package/dist/lib/neutral/index.mjs +4 -4
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/meta.mjs +1 -1
- package/dist/lib/neutral/{navigation-resolver-3KBOMN4U.mjs → navigation-resolver-3WEM7SSC.mjs} +3 -3
- package/dist/lib/neutral/navigation-resolver-3WEM7SSC.mjs.map +7 -0
- package/dist/lib/neutral/{open-5YC77C4O.mjs → open-F7KLNKVN.mjs} +2 -2
- package/dist/lib/neutral/operations/index.mjs +1 -1
- package/dist/lib/neutral/plugin.mjs +2 -2
- package/dist/lib/neutral/{react-surface-XYZJBKHZ.mjs → react-surface-6LX4ZQ2H.mjs} +7 -12
- package/dist/lib/neutral/react-surface-6LX4ZQ2H.mjs.map +7 -0
- package/dist/lib/neutral/{scroll-to-anchor-GAFB7W55.mjs → scroll-to-anchor-ACND3WJU.mjs} +2 -2
- package/dist/lib/neutral/{set-view-mode-N7UHYMPG.mjs → set-view-mode-WDC7CAEC.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/state-ZYT3JRWT.mjs +69 -0
- package/dist/lib/neutral/state-ZYT3JRWT.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-NNINDDV5.mjs → update-markdown-FGVN3LD4.mjs} +2 -2
- 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/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 +9 -16
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/navigation-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +1 -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/state.d.ts +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 +2 -2
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.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/containers/MarkdownArticle/MarkdownArticle.d.ts +4 -4
- 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/hooks/useExtensions.d.ts +3 -3
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +28 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/paths.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownCapabilities.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +31 -0
- package/package.json +41 -40
- package/src/MarkdownPlugin.test.ts +1 -1
- package/src/MarkdownPlugin.tsx +5 -10
- package/src/capabilities/app-graph-builder.ts +1 -3
- package/src/capabilities/editor-view-state.ts +28 -0
- package/src/capabilities/index.ts +2 -14
- package/src/capabilities/navigation-resolver.ts +2 -2
- package/src/capabilities/react-surface.tsx +20 -10
- package/src/capabilities/settings.ts +2 -2
- package/src/capabilities/state.ts +8 -4
- package/src/components/MarkdownEditor/FileUpload.tsx +2 -2
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +4 -4
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +4 -3
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +2 -2
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +1 -1
- package/src/containers/MarkdownArticle/MarkdownArticle.stories.tsx +3 -4
- package/src/containers/MarkdownArticle/MarkdownArticle.tsx +3 -3
- package/src/containers/MarkdownCard/MarkdownCard.tsx +1 -1
- package/src/hooks/useEditorMenuOptions.ts +1 -1
- package/src/hooks/useExtensions.tsx +11 -11
- package/src/meta.ts +2 -22
- package/src/operations/create.conversations.json +1 -1
- package/src/operations/update.conversations.json +1 -1
- package/src/paths.ts +4 -2
- package/src/testing.ts +2 -2
- package/src/translations.ts +1 -1
- package/src/types/Markdown.ts +3 -3
- package/src/types/MarkdownCapabilities.ts +7 -5
- package/src/types/MarkdownEvents.ts +1 -1
- package/src/types/MarkdownOperation.ts +1 -1
- package/dist/lib/neutral/MarkdownArticle-LWT5RFFJ.mjs.map +0 -7
- package/dist/lib/neutral/MarkdownCard-TBLIRDBO.mjs.map +0 -7
- 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/chunk-36QFEVOZ.mjs +0 -30
- package/dist/lib/neutral/chunk-36QFEVOZ.mjs.map +0 -7
- package/dist/lib/neutral/chunk-67DKWOKF.mjs.map +0 -7
- package/dist/lib/neutral/chunk-CIJD7P6X.mjs +0 -8
- package/dist/lib/neutral/chunk-Y2LQRUU7.mjs.map +0 -7
- 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/types/src/capabilities/app-graph-serializer.d.ts +0 -5
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +0 -1
- package/src/capabilities/app-graph-serializer.ts +0 -64
- /package/dist/lib/neutral/{chunk-CIJD7P6X.mjs.map → chunk-BL46CERY.mjs.map} +0 -0
- /package/dist/lib/neutral/{create-JK35XC4R.mjs.map → create-XW2FQNLK.mjs.map} +0 -0
- /package/dist/lib/neutral/{create-markdown-7MLE625M.mjs.map → create-markdown-KLSVQCT7.mjs.map} +0 -0
- /package/dist/lib/neutral/{create-object-MU2LGXG6.mjs.map → create-object-3WMEQJ2C.mjs.map} +0 -0
- /package/dist/lib/neutral/{open-5YC77C4O.mjs.map → open-F7KLNKVN.mjs.map} +0 -0
- /package/dist/lib/neutral/{scroll-to-anchor-GAFB7W55.mjs.map → scroll-to-anchor-ACND3WJU.mjs.map} +0 -0
- /package/dist/lib/neutral/{set-view-mode-N7UHYMPG.mjs.map → set-view-mode-WDC7CAEC.mjs.map} +0 -0
- /package/dist/lib/neutral/{update-markdown-NNINDDV5.mjs.map → update-markdown-FGVN3LD4.mjs.map} +0 -0
package/src/paths.ts
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Paths } from '@dxos/app-toolkit';
|
|
6
6
|
|
|
7
7
|
import { Markdown } from '#types';
|
|
8
8
|
|
|
9
|
-
const { getSectionPath: getDocumentsPath, getObjectPath: getDocumentPath } = createTypeSectionPaths(
|
|
9
|
+
const { getSectionPath: getDocumentsPath, getObjectPath: getDocumentPath } = Paths.createTypeSectionPaths(
|
|
10
|
+
Markdown.Document,
|
|
11
|
+
);
|
|
10
12
|
|
|
11
13
|
export { getDocumentsPath, getDocumentPath };
|
package/src/testing.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Toolkit from '@effect/ai/Toolkit';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { AppAnnotation } from '@dxos/app-toolkit';
|
|
9
9
|
import { SpaceProperties } from '@dxos/client-protocol';
|
|
10
10
|
import { Annotation, Collection, Database, Obj, Ref } from '@dxos/echo';
|
|
11
11
|
|
|
@@ -31,7 +31,7 @@ export const WithProperties = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.
|
|
|
31
31
|
if (!meta.annotations) {
|
|
32
32
|
meta.annotations = {};
|
|
33
33
|
}
|
|
34
|
-
Annotation.setDictionary(meta.annotations, RootCollectionAnnotation, Ref.make(collection));
|
|
34
|
+
Annotation.setDictionary(meta.annotations, AppAnnotation.RootCollectionAnnotation, Ref.make(collection));
|
|
35
35
|
});
|
|
36
36
|
}),
|
|
37
37
|
effect,
|
package/src/translations.ts
CHANGED
|
@@ -23,7 +23,7 @@ export const translations = [
|
|
|
23
23
|
'delete-object.label': 'Delete document',
|
|
24
24
|
'object-deleted.label': 'Document deleted',
|
|
25
25
|
},
|
|
26
|
-
[meta.
|
|
26
|
+
[meta.profile.key]: {
|
|
27
27
|
'plugin.name': 'Editor',
|
|
28
28
|
'choose-markdown-from-space-dialog.title': 'Choose one or more documents to add',
|
|
29
29
|
'empty-choose-markdown-from-space.message': 'None available; try creating a new one instead?',
|
package/src/types/Markdown.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { AppAnnotation } from '@dxos/app-toolkit';
|
|
8
8
|
import { DXN, Annotation, Obj, Ref, Type } from '@dxos/echo';
|
|
9
9
|
import { DescriptionAnnotation, FormInputAnnotation, LabelAnnotation } from '@dxos/echo/Annotation';
|
|
10
10
|
import { Text } from '@dxos/schema';
|
|
@@ -28,8 +28,8 @@ export const Document = Schema.Struct({
|
|
|
28
28
|
LabelAnnotation.set(['name', 'fallbackName']),
|
|
29
29
|
DescriptionAnnotation.set('description'),
|
|
30
30
|
Annotation.IconAnnotation.set({ icon: 'ph--text-aa--regular', hue: 'indigo' }),
|
|
31
|
-
BlueprintsAnnotation.set([BLUEPRINT_KEY]),
|
|
32
|
-
GraphPropsAnnotation.set({ managesAutofocus: true }),
|
|
31
|
+
AppAnnotation.BlueprintsAnnotation.set([BLUEPRINT_KEY]),
|
|
32
|
+
AppAnnotation.GraphPropsAnnotation.set({ managesAutofocus: true }),
|
|
33
33
|
Type.makeObject(DXN.make('org.dxos.type.document', '0.1.0')),
|
|
34
34
|
);
|
|
35
35
|
|
|
@@ -36,16 +36,18 @@ export type EditorViewRegistry = {
|
|
|
36
36
|
get: (attendableId: string) => EditorViewEntry | undefined;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
export const Settings = Capability.make<Atom.Writable<Markdown.Settings>>(`${meta.
|
|
39
|
+
export const Settings = Capability.make<Atom.Writable<Markdown.Settings>>(`${meta.profile.key}.capability.settings`);
|
|
40
40
|
|
|
41
41
|
/** Persisted state atom for view mode per document. */
|
|
42
|
-
export const State = Capability.make<Atom.Writable<MarkdownState>>(`${meta.
|
|
42
|
+
export const State = Capability.make<Atom.Writable<MarkdownState>>(`${meta.profile.key}.capability.state`);
|
|
43
43
|
|
|
44
44
|
/** Editor state store for cursor positions, scroll state, etc. */
|
|
45
|
-
export const EditorState = Capability.make<EditorStateStore>(`${meta.
|
|
45
|
+
export const EditorState = Capability.make<EditorStateStore>(`${meta.profile.key}.capability.editor-state`);
|
|
46
46
|
|
|
47
47
|
/** Registry of active EditorView instances keyed by attendable ID. */
|
|
48
|
-
export const EditorViews = Capability.make<EditorViewRegistry>(`${meta.
|
|
48
|
+
export const EditorViews = Capability.make<EditorViewRegistry>(`${meta.profile.key}.capability.editor-views`);
|
|
49
49
|
|
|
50
50
|
// TODO(burdon): Move to ./types (external API)?
|
|
51
|
-
export const ExtensionProvider = Capability.make<MarkdownExtensionProvider[]>(
|
|
51
|
+
export const ExtensionProvider = Capability.make<MarkdownExtensionProvider[]>(
|
|
52
|
+
`${meta.profile.key}.capability.extensions`,
|
|
53
|
+
);
|
|
@@ -10,5 +10,5 @@ import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
|
10
10
|
import { meta } from '#meta';
|
|
11
11
|
|
|
12
12
|
export const SetupExtensions: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(
|
|
13
|
-
`${meta.
|
|
13
|
+
`${meta.profile.key}.event.setup-extensions`,
|
|
14
14
|
);
|
|
@@ -16,7 +16,7 @@ import { meta } from '#meta';
|
|
|
16
16
|
|
|
17
17
|
import * as Markdown from './Markdown';
|
|
18
18
|
|
|
19
|
-
const makeKey = (name: string) => DXN.make(`${meta.
|
|
19
|
+
const makeKey = (name: string) => DXN.make(`${meta.profile.key}.operation.${name}`);
|
|
20
20
|
|
|
21
21
|
const Edit = Schema.Struct({
|
|
22
22
|
oldString: Schema.String.annotations({
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/containers/MarkdownArticle/MarkdownArticle.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Extension } from '@codemirror/state';\nimport { Atom } from '@effect-atom/atom-react';\nimport React, { forwardRef, useCallback, useMemo } from 'react';\n\nimport { useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';\nimport { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';\nimport { AppSurface, useAppGraph } from '@dxos/app-toolkit/ui';\nimport { Obj } from '@dxos/echo';\nimport { useActionRunner } from '@dxos/plugin-graph';\nimport { useObject } from '@dxos/react-client/echo';\nimport { Panel } from '@dxos/react-ui';\nimport { type SelectionManager } from '@dxos/react-ui-attention';\nimport { Editor } from '@dxos/react-ui-editor';\nimport { Text } from '@dxos/schema';\n\nimport {\n MarkdownEditor,\n MarkdownEditorProvider,\n type MarkdownEditorContentProps,\n type MarkdownEditorProviderProps,\n} from '#components';\nimport { useLinkQuery } from '#hooks';\nimport { Markdown, MarkdownCapabilities, type MarkdownPluginState } from '#types';\n\nexport type MarkdownArticleProps = AppSurface.ObjectArticleProps<\n Markdown.Document | Text.Text,\n {\n id: string;\n settings: Markdown.Settings;\n selectionManager?: SelectionManager;\n } & Pick<MarkdownPluginState, 'extensionProviders'> &\n Pick<MarkdownEditorProviderProps, 'viewMode' | 'onSelectObject' | 'onViewModeChange'> &\n Pick<MarkdownEditorContentProps, 'editorStateStore'>\n>;\n\nexport const MarkdownArticle = forwardRef<HTMLDivElement, MarkdownArticleProps>(\n (\n { role, subject: object, id, attendableId, settings, extensionProviders, onSelectObject, viewMode, ...props },\n forwardedRef,\n ) => {\n const db = Obj.isObject(object) ? Obj.getDatabase(object) : undefined;\n const [docContent] = useObject(Obj.instanceOf(Markdown.Document, object) ? object.content : undefined, 'content');\n const [textContent] = useObject(Obj.instanceOf(Text.Text, object) ? object : undefined, 'content');\n const initialValue = docContent ?? textContent;\n\n // Extensions from other plugins.\n const otherExtensionProviders = useCapabilities(MarkdownCapabilities.ExtensionProvider);\n const extensions = useMemo<Extension[]>(() => {\n if (!Obj.instanceOf(Markdown.Document, object) && !Obj.instanceOf(Text.Text, object)) {\n return [];\n }\n\n const document = Obj.instanceOf(Markdown.Document, object) ? object : undefined;\n return [...(otherExtensionProviders ?? []), ...(extensionProviders ?? [])]\n .flat()\n .reduce((acc: Extension[], provider) => {\n const extension = typeof provider === 'function' ? provider({ document, viewMode }) : provider;\n if (extension) {\n acc.push(extension);\n }\n\n return acc;\n }, []);\n }, [extensionProviders, otherExtensionProviders, object, viewMode]);\n\n // Toolbar actions from app graph.\n const { graph } = useAppGraph();\n const runAction = useActionRunner();\n const customActions = useMemo(() => {\n return Atom.make((get) => {\n const actions = get(graph.actions(attendableId ?? id));\n const nodes = actions.filter((action) => action.properties.disposition === 'toolbar');\n const edges = nodes.map((node) => ({ source: 'root', target: node.id, relation: 'child' }));\n return { nodes, edges };\n });\n }, [graph]);\n\n // File upload.\n const [upload] = useCapabilities(AppCapabilities.FileUploader);\n const handleFileUpload = useMemo(() => {\n if (!db || !upload) {\n return undefined;\n }\n\n return async (file: File) => upload(db, file);\n }, [db, upload]);\n\n // Query for @ refs.\n const handleLinkQuery = useLinkQuery(db);\n\n // Open linked objects.\n const { invokePromise } = useOperationInvoker();\n const handleSelectObject = useCallback(\n (targetId: string) => {\n if (onSelectObject) {\n onSelectObject(targetId);\n } else {\n void invokePromise?.(LayoutOperation.Open, {\n subject: [targetId],\n pivotId: attendableId,\n // TODO(wittjosiah): This should probably pre-validate.\n navigation: 'immediate',\n });\n }\n },\n [onSelectObject, invokePromise, attendableId],\n );\n\n return (\n <MarkdownEditorProvider\n id={id}\n attendableId={attendableId}\n object={object}\n compact={role !== 'article'}\n extensions={extensions}\n settings={settings}\n viewMode={viewMode}\n onAction={runAction}\n onFileUpload={handleFileUpload}\n onLinkQuery={handleLinkQuery}\n onSelectObject={handleSelectObject}\n {...props}\n >\n {(editorRootProps) => (\n <Editor.Root {...editorRootProps}>\n <Panel.Root role={role} ref={forwardedRef}>\n {settings.toolbar && (\n <Panel.Toolbar classNames='bg-toolbar-surface'>\n <MarkdownEditor.Toolbar classNames='dx-document' customActions={customActions} />\n </Panel.Toolbar>\n )}\n <Panel.Content>\n <MarkdownEditor.Content initialValue={initialValue} />\n <MarkdownEditor.Blocks />\n </Panel.Content>\n </Panel.Root>\n </Editor.Root>\n )}\n </MarkdownEditorProvider>\n );\n },\n);\n"],
|
|
5
|
-
"mappings": ";;;AAKA,SAASA,YAAY;AACrB,OAAOC,SAASC,YAAYC,aAAaC,eAAe;AAExD,SAASC,iBAAiBC,2BAA2B;AACrD,SAASC,iBAAiBC,uBAAuB;AACjD,SAAqBC,mBAAmB;AACxC,SAASC,WAAW;AACpB,SAASC,uBAAuB;AAChC,SAASC,iBAAiB;AAC1B,SAASC,aAAa;AAEtB,SAASC,cAAc;AACvB,SAASC,YAAY;AAErB,SACEC,gBACAC,8BAGK;AACP,SAASC,oBAAoB;AAC7B,SAASC,UAAUC,4BAAsD;AAalE,IAAMC,kBAAkBnB,2BAC7B,CACE,EAAEoB,MAAMC,SAASC,QAAQC,IAAIC,cAAcC,UAAUC,oBAAoBC,gBAAgBC,UAAU,GAAGC,MAAAA,GACtGC,iBAAAA;AAEA,QAAMC,KAAKvB,IAAIwB,SAASV,MAAAA,IAAUd,IAAIyB,YAAYX,MAAAA,IAAUY;AAC5D,QAAM,CAACC,UAAAA,IAAczB,UAAUF,IAAI4B,WAAWnB,SAASoB,UAAUf,MAAAA,IAAUA,OAAOgB,UAAUJ,QAAW,SAAA;AACvG,QAAM,CAACK,WAAAA,IAAe7B,UAAUF,IAAI4B,WAAWvB,KAAKA,MAAMS,MAAAA,IAAUA,SAASY,QAAW,SAAA;AACxF,QAAMM,eAAeL,cAAcI;AAGnC,QAAME,0BAA0BtC,gBAAgBe,qBAAqBwB,iBAAiB;AACtF,QAAMC,aAAazC,QAAqB,MAAA;AACtC,QAAI,CAACM,IAAI4B,WAAWnB,SAASoB,UAAUf,MAAAA,KAAW,CAACd,IAAI4B,WAAWvB,KAAKA,MAAMS,MAAAA,GAAS;AACpF,aAAO,CAAA;IACT;AAEA,UAAMsB,W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,aAAAA;AACC,QAAIhD,gBAAgB;AAClBA,qBAAegD,QAAAA;IACjB,OAAO;AACL,WAAKF,gBAAgBnE,gBAAgBsE,MAAM;QACzCvD,SAAS;UAACsD;;QACVE,SAASrD;;QAETsD,YAAY;MACd,CAAA;IACF;EACF,GACA;IAACnD;IAAgB8C;IAAejD;GAAa;AAG/C,SACE,sBAAA,cAACT,wBAAAA;IACCQ;IACAC;IACAF;IACAyD,SAAS3D,SAAS;IAClBuB;IACAlB;IACAG;IACAoD,UAAU5B;IACV6B,cAAcX;IACdY,aAAaV;IACb7C,gBAAgB+C;IACf,GAAG7C;KAEH,CAACsD,oBACA,sBAAA,cAACvE,OAAOwE,MAASD,iBACf,sBAAA,cAACxE,MAAMyE,MAAI;IAAChE;IAAYiE,KAAKvD;KAC1BL,SAAS6D,WACR,sBAAA,cAAC3E,MAAM4E,SAAO;IAACC,YAAW;KACxB,sBAAA,cAAC1E,eAAeyE,SAAO;IAACC,YAAW;IAAcnC;OAGrD,sBAAA,cAAC1C,MAAM8E,SAAO,MACZ,sBAAA,cAAC3E,eAAe2E,SAAO;IAACjD;MACxB,sBAAA,cAAC1B,eAAe4E,QAAM,IAAA,CAAA,CAAA,CAAA,CAAA;AAOpC,CAAA;",
|
|
6
|
-
"names": ["Atom", "React", "forwardRef", "useCallback", "useMemo", "useCapabilities", "useOperationInvoker", "AppCapabilities", "LayoutOperation", "useAppGraph", "Obj", "useActionRunner", "useObject", "Panel", "Editor", "Text", "MarkdownEditor", "MarkdownEditorProvider", "useLinkQuery", "Markdown", "MarkdownCapabilities", "MarkdownArticle", "role", "subject", "object", "id", "attendableId", "settings", "extensionProviders", "onSelectObject", "viewMode", "props", "forwardedRef", "db", "isObject", "getDatabase", "undefined", "docContent", "instanceOf", "Document", "content", "textContent", "initialValue", "otherExtensionProviders", "ExtensionProvider", "extensions", "document", "flat", "reduce", "acc", "provider", "extension", "push", "graph", "runAction", "customActions", "make", "get", "actions", "nodes", "filter", "action", "properties", "disposition", "edges", "map", "node", "source", "target", "relation", "upload", "FileUploader", "handleFileUpload", "file", "handleLinkQuery", "invokePromise", "handleSelectObject", "targetId", "Open", "pivotId", "navigation", "compact", "onAction", "onFileUpload", "onLinkQuery", "editorRootProps", "Root", "ref", "toolbar", "Toolbar", "classNames", "Content", "Blocks"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/containers/MarkdownCard/MarkdownCard.tsx", "../../../src/containers/MarkdownCard/snippet.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useMemo } from 'react';\n\nimport { Obj } from '@dxos/echo';\nimport { Card, useTranslation } from '@dxos/react-ui';\nimport { Editor } from '@dxos/react-ui-editor';\nimport { Text } from '@dxos/schema';\nimport { mx } from '@dxos/ui-theme';\n\nimport { MarkdownEditor, MarkdownEditorProvider } from '#components';\nimport { meta } from '#meta';\nimport { Markdown } from '#types';\n\nimport { getContentSnippet } from '../../util';\nimport { snippet as snippetExtension } from './snippet';\n\nexport type MarkdownCardProps = { subject: Markdown.Document | Text.Text };\n\nexport const MarkdownCard = ({ subject }: MarkdownCardProps) => {\n const { t } = useTranslation(meta.id);\n // NOTE: Newline is added so that Fade does not obscure the last line.\n const snippet = useMemo(() => getSnippet(subject) + '\\n', [subject]);\n const extensions = useMemo(() => [snippetExtension({ height: 300, scale: 0.8 })], []);\n const info = getInfo(subject);\n\n return (\n <Card.Body>\n {snippet && (\n <Card.Section className='relative'>\n <Card.Row fullWidth>\n <MarkdownEditorProvider id={subject.id} viewMode='readonly' extensions={extensions}>\n {(editorRootProps) => (\n <Editor.Root {...editorRootProps}>\n <MarkdownEditor.Content initialValue={snippet} slots={{ content: { className: 'px-2!' } }} compact />\n </Editor.Root>\n )}\n </MarkdownEditorProvider>\n <Fade />\n </Card.Row>\n </Card.Section>\n )}\n <Card.Section>\n <Card.Row fullWidth>\n <Card.Text classNames='px-2 text-xs text-description'>\n {info.words} {t('words.label', { count: info.words })}\n </Card.Text>\n </Card.Row>\n </Card.Section>\n </Card.Body>\n );\n};\n\nconst Fade = () => (\n <div\n className={mx(\n 'z-10 absolute bottom-0 inset-x-0 h-6 w-full',\n 'bg-gradient-to-b from-transparent to-(--surface-bg) pointer-events-none',\n )}\n />\n);\n\nconst getSnippet = (subject: Markdown.Document | Text.Text, fallback?: string, maxLines = 16) => {\n if (Obj.instanceOf(Markdown.Document, subject)) {\n return Obj.getDescription(subject) || getContentSnippet(subject.content?.target?.content ?? fallback, maxLines);\n } else if (Obj.instanceOf(Text.Text, subject)) {\n return getContentSnippet(subject.content ?? fallback, maxLines);\n }\n};\n\nconst getInfo = (subject: Markdown.Document | Text.Text) => {\n const text = (Obj.instanceOf(Markdown.Document, subject) ? subject.content?.target?.content : subject.content) ?? '';\n return { words: text.split(' ').length };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { EditorState } from '@codemirror/state';\nimport { EditorView } from '@codemirror/view';\n\nexport type SnippetOptions = {\n /** Maximum height of the editor in pixels. Overflowing content is hidden. */\n height: number;\n /** Zoom factor applied to the editor (e.g. 0.5 renders at 50%). @default 1 */\n scale?: number;\n};\n\n/**\n * CodeMirror extension for rendering a non-scrollable snippet of editor content.\n * Constrains the editor to the given height via CSS `max-height`, wraps long\n * lines (`pre-wrap`), and disables scrolling entirely.\n *\n * NOTE: Uses CSS `zoom` rather than `transform: scale` because `zoom` affects\n * layout, so line wrapping fills the full visual width of the container.\n * `transform: scale` only scales paint output, leaving empty space on the right.\n */\nexport const snippet = ({ height, scale = 1 }: SnippetOptions) => {\n return [\n EditorState.readOnly.of(true),\n EditorView.editable.of(false),\n EditorState.transactionFilter.of((tr) => {\n if (tr.selection) {\n return [];\n } // Drop any selection changes.\n return tr;\n }),\n EditorView.theme({\n // Outer editor element: clip to the caller-specified height.\n '&': {\n maxHeight: `${height}px`,\n overflow: 'hidden',\n },\n '.cm-scroller': {\n // Prevent scroll; scale up the inner clip so the final pixel height matches `height`.\n maxHeight: `${height / scale}px`,\n overflow: 'hidden !important',\n padding: '0',\n },\n '.cm-content': {\n // zoom (unlike transform: scale) affects layout, so line-wrapping fills the full visual width of the container.\n zoom: scale,\n margin: '0',\n padding: '0',\n },\n }),\n ];\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,OAAOA,SAASC,eAAe;AAE/B,SAASC,WAAW;AACpB,SAASC,MAAMC,sBAAsB;AACrC,SAASC,cAAc;AACvB,SAASC,YAAY;AACrB,SAASC,UAAU;AAEnB,SAASC,gBAAgBC,8BAA8B;AACvD,SAASC,YAAY;AACrB,SAASC,gBAAgB;;;ACVzB,SAASC,mBAAmB;AAC5B,SAASC,kBAAkB;AAkBpB,IAAMC,UAAU,CAAC,EAAEC,QAAQC,QAAQ,EAAC,MAAkB;AAC3D,SAAO;IACLJ,YAAYK,SAASC,GAAG,IAAA;IACxBL,WAAWM,SAASD,GAAG,KAAA;IACvBN,YAAYQ,kBAAkBF,GAAG,CAACG,OAAAA;AAChC,UAAIA,GAAGC,WAAW;AAChB,eAAO,CAAA;MACT;AACA,aAAOD;IACT,CAAA;IACAR,WAAWU,MAAM;;MAEf,KAAK;QACHC,WAAW,GAAGT,MAAAA;QACdU,UAAU;MACZ;MACA,gBAAgB;;QAEdD,WAAW,GAAGT,SAASC,KAAAA;QACvBS,UAAU;QACVC,SAAS;MACX;MACA,eAAe;;QAEbC,MAAMX;QACNY,QAAQ;QACRF,SAAS;MACX;IACF,CAAA;;AAEJ;;;ADhCO,IAAMG,eAAe,CAAC,EAAEC,QAAO,MAAqB;AACzD,QAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AAEpC,QAAMC,WAAUC,QAAQ,MAAMC,WAAWP,OAAAA,IAAW,MAAM;IAACA;GAAQ;AACnE,QAAMQ,aAAaF,QAAQ,MAAM;IAACG,QAAiB;MAAEC,QAAQ;MAAKC,OAAO;IAAI,CAAA;KAAK,CAAA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,UAAU7B,QAAQ6B,YAAY;AAClH,SAAO;IAAEK,OAAOa,KAAKC,MAAM,GAAA,EAAKC;EAAO;AACzC;",
|
|
6
|
-
"names": ["React", "useMemo", "Obj", "Card", "useTranslation", "Editor", "Text", "mx", "MarkdownEditor", "MarkdownEditorProvider", "meta", "Markdown", "EditorState", "EditorView", "snippet", "height", "scale", "readOnly", "of", "editable", "transactionFilter", "tr", "selection", "theme", "maxHeight", "overflow", "padding", "zoom", "margin", "MarkdownCard", "subject", "t", "useTranslation", "meta", "id", "snippet", "useMemo", "getSnippet", "extensions", "snippetExtension", "height", "scale", "info", "getInfo", "Card", "Body", "Section", "className", "Row", "fullWidth", "MarkdownEditorProvider", "viewMode", "editorRootProps", "Editor", "Root", "MarkdownEditor", "Content", "initialValue", "slots", "content", "compact", "Fade", "Text", "classNames", "words", "count", "div", "mx", "fallback", "maxLines", "Obj", "instanceOf", "Markdown", "Document", "getDescription", "getContentSnippet", "target", "text", "split", "length"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities, LayoutOperation, createTypeSectionExtension } from '@dxos/app-toolkit';\nimport { isSpace } from '@dxos/client/echo';\nimport { Operation } from '@dxos/compute';\nimport { Type } from '@dxos/echo';\nimport { GraphBuilder, Node } from '@dxos/plugin-graph';\nimport { SpaceOperation } from '@dxos/plugin-space';\n\nimport { Markdown } from '#types';\n\nimport { getDocumentsPath } from '../paths';\n\nconst documentTypename = Type.getTypename(Markdown.Document);\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const extensions = yield* Effect.all([\n createTypeSectionExtension(Markdown.Document),\n\n GraphBuilder.createExtension({\n id: 'documentsSectionActions',\n match: (node) => {\n const space = isSpace(node.properties.space) ? node.properties.space : undefined;\n return node.type === documentTypename && space ? Option.some(space) : Option.none();\n },\n actions: (space) =>\n Effect.succeed([\n Node.makeAction({\n id: 'create-document',\n data: () =>\n Effect.gen(function* () {\n const doc = Markdown.make({});\n const { subject } = yield* Operation.invoke(\n SpaceOperation.AddObject,\n { object: doc, target: space.db, hidden: true, targetNodeId: getDocumentsPath(space.db.spaceId) },\n { spaceId: space.db.spaceId },\n );\n yield* Operation.invoke(\n LayoutOperation.Open,\n { subject: [...subject] },\n { spaceId: space.db.spaceId },\n );\n }),\n properties: {\n label: ['add-object.label', { ns: documentTypename }],\n icon: 'ph--plus--regular',\n disposition: 'list-item-primary',\n },\n }),\n ]),\n }),\n ]);\n\n return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,iBAAiBC,iBAAiBC,kCAAkC;AAC7E,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,YAAY;AACrB,SAASC,cAAcC,YAAY;AACnC,SAASC,sBAAsB;AAE/B,SAASC,gBAAgB;AAIzB,IAAMC,mBAAmBC,KAAKC,YAAYC,SAASC,QAAQ;AAE3D,IAAA,4BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,aAAa,OAAcC,WAAI;IACnCC,2BAA2BP,SAASC,QAAQ;IAE5CO,aAAaC,gBAAgB;MAC3BC,IAAI;MACJC,OAAO,CAACC,SAAAA;AACN,cAAMC,QAAQC,QAAQF,KAAKG,WAAWF,KAAK,IAAID,KAAKG,WAAWF,QAAQG;AACvE,eAAOJ,KAAKK,SAASpB,oBAAoBgB,QAAeK,YAAKL,KAAAA,IAAgBM,YAAI;MACnF;MACAC,SAAS,CAACP,UACDQ,eAAQ;QACbC,KAAKC,WAAW;UACdb,IAAI;UACJc,MAAM,MACGC,WAAI,aAAA;AACT,kBAAMC,MAAM1B,SAAS2B,KAAK,CAAC,CAAA;AAC3B,kBAAM,EAAEC,QAAO,IAAK,OAAOC,UAAUC,OACnCC,eAAeC,WACf;cAAEC,QAAQP;cAAKQ,QAAQrB,MAAMsB;cAAIC,QAAQ;cAAMC,cAAcC,iBAAiBzB,MAAMsB,GAAGI,OAAO;YAAE,GAChG;cAAEA,SAAS1B,MAAMsB,GAAGI;YAAQ,CAAA;AAE9B,mBAAOV,UAAUC,OACfU,gBAAgBC,MAChB;cAAEb,SAAS;mBAAIA;;YAAS,GACxB;cAAEW,SAAS1B,MAAMsB,GAAGI;YAAQ,CAAA;UAEhC,CAAA;UACFxB,YAAY;YACV2B,OAAO;cAAC;cAAoB;gBAAEC,IAAI9C;cAAiB;;YACnD+C,MAAM;YACNC,aAAa;UACf;QACF,CAAA;OACD;IACL,CAAA;GACD;AAED,SAAO3C,WAAW4C,YAAYC,gBAAgBC,iBAAiB3C,UAAAA;AACjE,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Option", "Capability", "AppCapabilities", "LayoutOperation", "createTypeSectionExtension", "isSpace", "Operation", "Type", "GraphBuilder", "Node", "SpaceOperation", "Markdown", "documentTypename", "Type", "getTypename", "Markdown", "Document", "Capability", "makeModule", "fnUntraced", "extensions", "all", "createTypeSectionExtension", "GraphBuilder", "createExtension", "id", "match", "node", "space", "isSpace", "properties", "undefined", "type", "some", "none", "actions", "succeed", "Node", "makeAction", "data", "gen", "doc", "make", "subject", "Operation", "invoke", "SpaceOperation", "AddObject", "object", "target", "db", "hidden", "targetNodeId", "getDocumentsPath", "spaceId", "LayoutOperation", "Open", "label", "ns", "icon", "disposition", "contributes", "AppCapabilities", "AppGraphBuilder"]
|
|
7
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
-
|
|
3
|
-
// src/capabilities/app-graph-serializer.ts
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
|
-
import * as Option from "effect/Option";
|
|
6
|
-
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
7
|
-
import { AppCapabilities, RootCollectionAnnotation } from "@dxos/app-toolkit";
|
|
8
|
-
import { Annotation, Collection, Obj, Type } from "@dxos/echo";
|
|
9
|
-
import { SpaceOperation } from "@dxos/plugin-space";
|
|
10
|
-
import { isSpace } from "@dxos/react-client/echo";
|
|
11
|
-
import { translations } from "#translations";
|
|
12
|
-
import { MarkdownOperation } from "#types";
|
|
13
|
-
import { Markdown } from "#types";
|
|
14
|
-
var app_graph_serializer_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
15
|
-
const capabilities = yield* Capability.Service;
|
|
16
|
-
return Capability.contributes(AppCapabilities.AppGraphSerializer, [
|
|
17
|
-
{
|
|
18
|
-
inputType: Type.getTypename(Markdown.Document),
|
|
19
|
-
outputType: "text/markdown",
|
|
20
|
-
// Reconcile with metadata serializers.
|
|
21
|
-
serialize: async (node) => {
|
|
22
|
-
const doc = node.data;
|
|
23
|
-
const content = await doc.content.load();
|
|
24
|
-
return {
|
|
25
|
-
name: doc.name || doc.fallbackName || translations[0]["en-US"][Type.getTypename(Markdown.Document)]["object-name.placeholder"],
|
|
26
|
-
data: content.content,
|
|
27
|
-
type: "text/markdown"
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
deserialize: async (data, ancestors) => {
|
|
31
|
-
const space = ancestors.find(isSpace);
|
|
32
|
-
const target = ancestors.findLast((ancestor) => Obj.instanceOf(Collection.Collection, ancestor)) ?? (space && Annotation.get(space.properties, RootCollectionAnnotation).pipe(Option.getOrUndefined)?.target);
|
|
33
|
-
if (!space || !target) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const { invokePromise } = capabilities.get(Capabilities.OperationInvoker);
|
|
37
|
-
const createResult = await invokePromise(MarkdownOperation.CreateMarkdown, {
|
|
38
|
-
name: data.name,
|
|
39
|
-
content: data.data
|
|
40
|
-
});
|
|
41
|
-
if (!createResult.data?.object) {
|
|
42
|
-
return void 0;
|
|
43
|
-
}
|
|
44
|
-
await invokePromise(SpaceOperation.AddObject, {
|
|
45
|
-
target,
|
|
46
|
-
object: createResult.data.object
|
|
47
|
-
});
|
|
48
|
-
return createResult.data.object;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
]);
|
|
52
|
-
}));
|
|
53
|
-
export {
|
|
54
|
-
app_graph_serializer_default as default
|
|
55
|
-
};
|
|
56
|
-
//# sourceMappingURL=app-graph-serializer-EN5E3BMG.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-serializer.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { AppCapabilities, RootCollectionAnnotation } from '@dxos/app-toolkit';\nimport { Annotation, Collection, Obj, Type } from '@dxos/echo';\nimport { SpaceOperation } from '@dxos/plugin-space';\nimport { isSpace } from '@dxos/react-client/echo';\n\nimport { translations } from '#translations';\nimport { MarkdownOperation } from '#types';\nimport { Markdown } from '#types';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n // Get context for lazy capability access in callbacks.\n const capabilities = yield* Capability.Service;\n\n return Capability.contributes(AppCapabilities.AppGraphSerializer, [\n {\n inputType: Type.getTypename(Markdown.Document),\n outputType: 'text/markdown',\n // Reconcile with metadata serializers.\n serialize: async (node) => {\n const doc = node.data;\n const content = await doc.content.load();\n return {\n name:\n doc.name ||\n doc.fallbackName ||\n translations[0]['en-US'][Type.getTypename(Markdown.Document)]['object-name.placeholder'],\n data: content.content,\n type: 'text/markdown',\n };\n },\n deserialize: async (data, ancestors) => {\n const space = ancestors.find(isSpace);\n const target =\n ancestors.findLast((ancestor) => Obj.instanceOf(Collection.Collection, ancestor)) ??\n (space && Annotation.get(space.properties, RootCollectionAnnotation).pipe(Option.getOrUndefined)?.target);\n if (!space || !target) {\n return;\n }\n\n const { invokePromise } = capabilities.get(Capabilities.OperationInvoker);\n const createResult = await invokePromise(MarkdownOperation.CreateMarkdown, {\n name: data.name,\n content: data.data,\n });\n if (!createResult.data?.object) {\n return undefined;\n }\n await invokePromise(SpaceOperation.AddObject, { target, object: createResult.data.object });\n\n return createResult.data.object;\n },\n },\n ]);\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;AAIA,YAAYA,YAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,iBAAiBC,gCAAgC;AAC1D,SAASC,YAAYC,YAAYC,KAAKC,YAAY;AAClD,SAASC,sBAAsB;AAC/B,SAASC,eAAe;AAExB,SAASC,oBAAoB;AAC7B,SAASC,yBAAyB;AAClC,SAASC,gBAAgB;AAEzB,IAAA,+BAAeX,WAAWY,WACjBC,kBAAW,aAAA;AAEhB,QAAMC,eAAe,OAAOd,WAAWe;AAEvC,SAAOf,WAAWgB,YAAYf,gBAAgBgB,oBAAoB;IAChE;MACEC,WAAWZ,KAAKa,YAAYR,SAASS,QAAQ;MAC7CC,YAAY;;MAEZC,WAAW,OAAOC,SAAAA;AAChB,cAAMC,MAAMD,KAAKE;AACjB,cAAMC,UAAU,MAAMF,IAAIE,QAAQC,KAAI;AACtC,eAAO;UACLC,MACEJ,IAAII,QACJJ,IAAIK,gBACJpB,aAAa,CAAA,EAAG,OAAA,EAASH,KAAKa,YAAYR,SAASS,QAAQ,CAAA,EAAG,yBAAA;UAChEK,MAAMC,QAAQA;UACdI,MAAM;QACR;MACF;MACAC,aAAa,OAAON,MAAMO,cAAAA;AACxB,cAAMC,QAAQD,UAAUE,KAAK1B,OAAAA;AAC7B,cAAM2B,SACJH,UAAUI,SAAS,CAACC,aAAahC,IAAIiC,WAAWlC,WAAWA,YAAYiC,QAAAA,CAAAA,MACtEJ,SAAS9B,WAAWoC,IAAIN,MAAMO,YAAYtC,wBAAAA,EAA0BuC,KAAYC,qBAAc,GAAGP;AACpG,YAAI,CAACF,SAAS,CAACE,QAAQ;AACrB;QACF;AAEA,cAAM,EAAEQ,cAAa,IAAK7B,aAAayB,IAAIxC,aAAa6C,gBAAgB;AACxE,cAAMC,eAAe,MAAMF,cAAcjC,kBAAkBoC,gBAAgB;UACzElB,MAAMH,KAAKG;UACXF,SAASD,KAAKA;QAChB,CAAA;AACA,YAAI,CAACoB,aAAapB,MAAMsB,QAAQ;AAC9B,iBAAOC;QACT;AACA,cAAML,cAAcpC,eAAe0C,WAAW;UAAEd;UAAQY,QAAQF,aAAapB,KAAKsB;QAAO,CAAA;AAEzF,eAAOF,aAAapB,KAAKsB;MAC3B;IACF;GACD;AACH,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Option", "Capabilities", "Capability", "AppCapabilities", "RootCollectionAnnotation", "Annotation", "Collection", "Obj", "Type", "SpaceOperation", "isSpace", "translations", "MarkdownOperation", "Markdown", "makeModule", "fnUntraced", "capabilities", "Service", "contributes", "AppGraphSerializer", "inputType", "getTypename", "Document", "outputType", "serialize", "node", "doc", "data", "content", "load", "name", "fallbackName", "type", "deserialize", "ancestors", "space", "find", "target", "findLast", "ancestor", "instanceOf", "get", "properties", "pipe", "getOrUndefined", "invokePromise", "OperationInvoker", "createResult", "CreateMarkdown", "object", "undefined", "AddObject"]
|
|
7
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// src/meta.ts
|
|
2
|
-
import { Plugin } from "@dxos/app-framework";
|
|
3
|
-
import { DXN } from "@dxos/keys";
|
|
4
|
-
import { trim } from "@dxos/util";
|
|
5
|
-
var meta = Plugin.makeMeta({
|
|
6
|
-
key: DXN.make("org.dxos.plugin.markdown"),
|
|
7
|
-
name: "Markdown",
|
|
8
|
-
author: "DXOS",
|
|
9
|
-
description: trim`
|
|
10
|
-
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.
|
|
11
|
-
|
|
12
|
-
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.
|
|
13
|
-
|
|
14
|
-
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.
|
|
15
|
-
|
|
16
|
-
A built-in blueprint 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.
|
|
17
|
-
`,
|
|
18
|
-
icon: "ph--text-aa--regular",
|
|
19
|
-
iconHue: "indigo",
|
|
20
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-markdown",
|
|
21
|
-
screenshots: [
|
|
22
|
-
"https://customer-5rxcjpyab08avpmn.cloudflarestream.com/cdf2656365bb1fd327c1fc2105d75e5a/iframe?poster=https%3A%2F%2Fcustomer-5rxcjpyab08avpmn.cloudflarestream.com%2Fcdf2656365bb1fd327c1fc2105d75e5a%2Fthumbnails%2Fthumbnail.jpg%3Ftime%3D%26height%3D600",
|
|
23
|
-
"https://dxos.network/plugin-details-markdown-dark.png"
|
|
24
|
-
]
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export {
|
|
28
|
-
meta
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=chunk-36QFEVOZ.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { DXN } from '@dxos/keys';\nimport { trim } from '@dxos/util';\n\nexport const meta = Plugin.makeMeta({\n key: DXN.make('org.dxos.plugin.markdown'),\n name: 'Markdown',\n author: 'DXOS',\n description: trim`\n 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.\n\n 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.\n\n 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.\n\n A built-in blueprint 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.\n `,\n icon: 'ph--text-aa--regular',\n iconHue: 'indigo',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-markdown',\n screenshots: [\n 'https://customer-5rxcjpyab08avpmn.cloudflarestream.com/cdf2656365bb1fd327c1fc2105d75e5a/iframe?poster=https%3A%2F%2Fcustomer-5rxcjpyab08avpmn.cloudflarestream.com%2Fcdf2656365bb1fd327c1fc2105d75e5a%2Fthumbnails%2Fthumbnail.jpg%3Ftime%3D%26height%3D600',\n 'https://dxos.network/plugin-details-markdown-dark.png',\n ],\n});\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,WAAW;AACpB,SAASC,YAAY;AAEd,IAAMC,OAAOH,OAAOI,SAAS;EAClCC,KAAKJ,IAAIK,KAAK,0BAAA;EACdC,MAAM;EACNC,QAAQ;EACRC,aAAaP;;;;;;;;;EASbQ,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,aAAa;IACX;IACA;;AAEJ,CAAA;",
|
|
6
|
-
"names": ["Plugin", "DXN", "trim", "meta", "makeMeta", "key", "make", "name", "author", "description", "icon", "iconHue", "source", "screenshots"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/paths.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createTypeSectionPaths } from '@dxos/app-toolkit';\n\nimport { Markdown } from '#types';\n\nconst { getSectionPath: getDocumentsPath, getObjectPath: getDocumentPath } = createTypeSectionPaths(Markdown.Document);\n\nexport { getDocumentsPath, getDocumentPath };\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,8BAA8B;AAEvC,SAASC,gBAAgB;AAEzB,IAAM,EAAEC,gBAAgBC,kBAAkBC,eAAeC,gBAAe,IAAKL,uBAAuBC,SAASK,QAAQ;",
|
|
6
|
-
"names": ["createTypeSectionPaths", "Markdown", "getSectionPath", "getDocumentsPath", "getObjectPath", "getDocumentPath", "Document"]
|
|
7
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// src/operations/index.ts
|
|
2
|
-
import { OperationHandlerSet } from "@dxos/compute";
|
|
3
|
-
var MarkdownOperationHandlerSet = OperationHandlerSet.lazy(() => import("./create-JK35XC4R.mjs"), () => import("./create-markdown-7MLE625M.mjs"), () => import("./open-5YC77C4O.mjs"), () => import("./scroll-to-anchor-GAFB7W55.mjs"), () => import("./set-view-mode-N7UHYMPG.mjs"), () => import("./update-markdown-NNINDDV5.mjs"));
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
MarkdownOperationHandlerSet
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=chunk-CIJD7P6X.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/Markdown.ts", "../../../src/types/Settings.ts", "../../../src/types/MarkdownCapabilities.ts", "../../../src/types/MarkdownEvents.ts", "../../../src/types/MarkdownOperation.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { BlueprintsAnnotation, GraphPropsAnnotation } from '@dxos/app-toolkit';\nimport { DXN, Annotation, Obj, Ref, Type } from '@dxos/echo';\nimport { DescriptionAnnotation, FormInputAnnotation, LabelAnnotation } from '@dxos/echo/Annotation';\nimport { Text } from '@dxos/schema';\n\nexport const BLUEPRINT_KEY = 'org.dxos.blueprint.markdown';\n\n// Re-export Settings as merged const/type (not as namespace).\nimport * as SettingsModule from './Settings';\nexport const Settings = SettingsModule.Settings;\nexport type Settings = SettingsModule.Settings;\n\n/**\n * Document Item type.\n */\nexport const Document = Schema.Struct({\n name: Schema.optional(Schema.String),\n description: Schema.optional(Schema.String),\n fallbackName: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),\n content: Ref.Ref(Text.Text).pipe(FormInputAnnotation.set(false)),\n}).pipe(\n LabelAnnotation.set(['name', 'fallbackName']),\n DescriptionAnnotation.set('description'),\n Annotation.IconAnnotation.set({ icon: 'ph--text-aa--regular', hue: 'indigo' }),\n BlueprintsAnnotation.set([BLUEPRINT_KEY]),\n GraphPropsAnnotation.set({ managesAutofocus: true }),\n Type.makeObject(DXN.make('org.dxos.type.document', '0.1.0')),\n);\n\nexport type Document = Type.InstanceType<typeof Document>;\n\n/**\n * Document factory.\n */\nexport const make = ({\n content = '',\n ...props\n}: Partial<{ name: string; fallbackName: string; content: string }> = {}) => {\n const doc = Obj.make(Document, { ...props, content: Ref.make(Text.make({ content })) });\n // TODO(dmaretskyi): We need a better way to set parents when creating hierarchies.\n Obj.setParent(doc.content.target!, doc);\n return doc;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { EditorInputMode, EditorViewMode } from '@dxos/ui-editor/types';\n\n/**\n * Determines how new comment threads on markdown documents are wired up to\n * the comment-thread AI agent (plugin-thread). The agent's identity (name,\n * DID) is resolved at runtime via the AgentIdentity capability — this\n * setting only controls whether and when the agent fires.\n *\n * - `off`: comments are plain user-only threads (no agent).\n * - `auto`: every user message in a thread triggers an agent response.\n * - `mention`: agent only responds when the message contains `@{agentName}`.\n */\nexport const CommentAgentMode = Schema.Union(Schema.Literal('off'), Schema.Literal('auto'), Schema.Literal('mention'));\nexport type CommentAgentMode = Schema.Schema.Type<typeof CommentAgentMode>;\n\n/**\n * Plugin settings.\n */\nexport const Settings = Schema.mutable(\n Schema.Struct({\n defaultViewMode: EditorViewMode.annotations({\n title: 'Default view mode',\n description: 'Set whether documents open in editing or read-only mode.',\n }),\n commentAgentMode: Schema.optional(\n CommentAgentMode.annotations({\n title: 'Comment agent mode',\n description:\n \"How new comment threads on markdown documents are processed: 'off' (no AI), 'auto' (AI responds to every user message), or 'mention' (AI responds only on @mention).\",\n }),\n ),\n editorInputMode: Schema.optional(\n EditorInputMode.annotations({\n title: 'Editor input mode',\n description: 'Choose keyboard bindings for the editor.',\n }),\n ),\n toolbar: Schema.optional(\n Schema.Boolean.annotations({\n title: 'Show toolbar',\n description: 'Display a formatting toolbar above the editor.',\n }),\n ),\n numberedHeadings: Schema.optional(\n Schema.Boolean.annotations({\n title: 'Numbered headings',\n description: 'Automatically number heading levels in the document.',\n }),\n ),\n folding: Schema.optional(\n Schema.Boolean.annotations({\n title: 'Folding',\n description: 'Allow collapsing and expanding sections by heading.',\n }),\n ),\n experimental: Schema.optional(\n Schema.Boolean.annotations({\n title: 'Enable experimental features',\n description: 'Turn on features that are still in development.',\n }),\n ),\n debug: Schema.optional(\n Schema.Boolean.annotations({\n title: 'Enable debugging features',\n description: 'Show developer tools and diagnostics for the editor.',\n }),\n ),\n snippets: Schema.optional(\n Schema.String.annotations({\n title: 'Snippets',\n description: 'Input snippets to replay for testing purposes.',\n }),\n ),\n }),\n);\n\nexport interface Settings extends Schema.Schema.Type<typeof Settings> {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport { type EditorView } from '@codemirror/view';\nimport { type Atom } from '@effect-atom/atom-react';\nimport * as Schema from 'effect/Schema';\n\nimport { Capability } from '@dxos/app-framework';\nimport { type EditorStateStore } from '@dxos/ui-editor';\nimport { type EditorViewMode } from '@dxos/ui-editor/types';\n\nimport { meta } from '#meta';\n\nimport type * as Markdown from './Markdown';\nimport { type MarkdownExtensionProvider } from './types';\n\n/** Schema for persisted markdown state. */\nexport const StateSchema = Schema.mutable(\n Schema.Struct({\n viewMode: Schema.Record({ key: Schema.String, value: Schema.String }),\n }),\n);\n\nexport type MarkdownState = {\n viewMode: Record<string, EditorViewMode>;\n};\n\nexport type EditorViewEntry = { view: EditorView; documentId: string };\n\nexport type EditorViewRegistry = {\n register: (attendableId: string, view: EditorView, documentId: string) => void;\n unregister: (attendableId: string) => void;\n get: (attendableId: string) => EditorViewEntry | undefined;\n};\n\nexport const Settings = Capability.make<Atom.Writable<Markdown.Settings>>(`${meta.id}.capability.settings`);\n\n/** Persisted state atom for view mode per document. */\nexport const State = Capability.make<Atom.Writable<MarkdownState>>(`${meta.id}.capability.state`);\n\n/** Editor state store for cursor positions, scroll state, etc. */\nexport const EditorState = Capability.make<EditorStateStore>(`${meta.id}.capability.editor-state`);\n\n/** Registry of active EditorView instances keyed by attendable ID. */\nexport const EditorViews = Capability.make<EditorViewRegistry>(`${meta.id}.capability.editor-views`);\n\n// TODO(burdon): Move to ./types (external API)?\nexport const ExtensionProvider = Capability.make<MarkdownExtensionProvider[]>(`${meta.id}.capability.extensions`);\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport { type ActivationEvent } from '@dxos/app-framework';\nimport { AppActivationEvents } from '@dxos/app-toolkit';\n\nimport { meta } from '#meta';\n\nexport const SetupExtensions: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(\n `${meta.id}.event.setup-extensions`,\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Capability } from '@dxos/app-framework';\nimport { Operation } from '@dxos/compute';\nimport { Database, Ref, Type, DXN } from '@dxos/echo';\nimport { EditorViewMode } from '@dxos/ui-editor/types';\nimport { trim } from '@dxos/util';\n\nimport { meta } from '#meta';\n\nimport * as Markdown from './Markdown';\n\nconst makeKey = (name: string) => DXN.make(`${meta.id}.operation.${name}`);\n\nconst Edit = Schema.Struct({\n oldString: Schema.String.annotations({\n description: 'The text to find in the document.',\n }),\n newString: Schema.String.annotations({\n description: 'The text to replace it with.',\n }),\n replaceAll: Schema.optional(Schema.Boolean).annotations({\n description: 'If true, replaces all occurrences. Defaults to false (first occurrence only).',\n }),\n});\n\nexport const Create = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.markdown.create'),\n name: 'Create',\n description: 'Creates a new markdown document and adds it to the space.',\n icon: 'ph--file-text--regular',\n },\n input: Schema.Struct({\n name: Schema.String,\n content: Schema.String,\n }),\n output: Schema.Struct({\n id: Schema.String.annotations({\n description: 'The DXN of the created document.',\n }),\n }),\n services: [Database.Service],\n});\n\nexport const CreateMarkdown = Operation.make({\n meta: {\n key: makeKey('create'),\n name: 'Create Markdown Document',\n icon: 'ph--file-text--regular',\n },\n services: [Capability.Service],\n input: Schema.Struct({\n name: Schema.optional(Schema.String),\n content: Schema.optional(Schema.String),\n }),\n output: Schema.Struct({\n object: Type.getSchema(Markdown.Document),\n }),\n});\n\nexport const Open = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.markdown.open'),\n name: 'Open',\n description: 'Opens and reads the contents of a new markdown document.',\n icon: 'ph--arrow-square-out--regular',\n },\n input: Schema.Struct({\n doc: Ref.Ref(Markdown.Document).annotations({\n description: 'The ID of the markdown document.',\n }),\n }),\n output: Schema.Struct({\n content: Schema.String,\n }),\n services: [Database.Service],\n});\n\nexport const ScrollToAnchor = Operation.make({\n meta: {\n key: makeKey('scrollToAnchor'),\n name: 'Scroll To Anchor',\n icon: 'ph--anchor-simple--regular',\n },\n services: [Capability.Service],\n input: Schema.Struct({\n subject: Schema.String.annotations({ description: 'Attendable ID of the markdown editor.' }),\n cursor: Schema.String.annotations({ description: 'Cursor position to scroll to.' }),\n ref: Schema.optional(Schema.String.annotations({ description: 'Reference ID (e.g. thread ID).' })),\n }),\n output: Schema.Void,\n});\n\n// TODO(wittjosiah): This appears to be unused.\nexport const SetViewMode = Operation.make({\n meta: { key: makeKey('setViewMode'), name: 'Set View Mode', icon: 'ph--layout--regular' },\n services: [Capability.Service],\n input: Schema.Struct({\n id: Schema.String,\n viewMode: EditorViewMode,\n }),\n output: Schema.Void,\n});\n\nexport const Update = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.markdown.update'),\n name: 'Update',\n description: trim`\n Applies a set of edits to the markdown document.\n `,\n icon: 'ph--pencil-simple--regular',\n },\n input: Schema.Struct({\n doc: Ref.Ref(Markdown.Document).annotations({\n description: 'The ID of the markdown document.',\n }),\n edits: Schema.Array(Edit).annotations({\n description: 'The edits to apply to the document. Each edit finds oldString and replaces it with newString.',\n }),\n }),\n output: Schema.Struct({\n newContent: Schema.String,\n }),\n services: [Database.Service],\n});\n"],
|
|
5
|
-
"mappings": ";;;;;AAAA;;;;kBAAAA;EAAA;;AAIA,YAAYC,aAAY;AAExB,SAASC,sBAAsBC,4BAA4B;AAC3D,SAASC,KAAKC,YAAYC,KAAKC,KAAKC,YAAY;AAChD,SAASC,uBAAuBC,qBAAqBC,uBAAuB;AAC5E,SAASC,YAAY;;;ACTrB;;;;;AAMA,YAAYC,YAAY;AAExB,SAASC,iBAAiBC,sBAAsB;AAYzC,IAAMC,mBAA0BC,aAAaC,eAAQ,KAAA,GAAeA,eAAQ,MAAA,GAAgBA,eAAQ,SAAA,CAAA;AAMpG,IAAMC,WAAkBC,eACtBC,cAAO;EACZC,iBAAiBP,eAAeQ,YAAY;IAC1CC,OAAO;IACPC,aAAa;EACf,CAAA;EACAC,kBAAyBC,gBACvBX,iBAAiBO,YAAY;IAC3BC,OAAO;IACPC,aACE;EACJ,CAAA,CAAA;EAEFG,iBAAwBD,gBACtBb,gBAAgBS,YAAY;IAC1BC,OAAO;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,eAAOC,YAAY;MAAEC,aAAa;IAAwC,CAAA;IAC1F0B,QAAe5B,eAAOC,YAAY;MAAEC,aAAa;IAAgC,CAAA;IACjF2B,KAAYxB,iBAAgBL,eAAOC,YAAY;MAAEC,aAAa;IAAiC,CAAA,CAAA;EACjG,CAAA;EACAW,QAAeiB;AACjB,CAAA;AAGO,IAAMC,cAAcvB,UAAUd,KAAK;EACxCC,MAAM;IAAEc,KAAKlB,QAAQ,aAAA;IAAgBC,MAAM;IAAiBkB,MAAM;EAAsB;EACxFI,UAAU;IAACI,YAAWF;;EACtBL,OAAcb,eAAO;IACnBF,IAAWI;IACXgC,UAAUC;EACZ,CAAA;EACApB,QAAeiB;AACjB,CAAA;AAEO,IAAMI,SAAS1B,UAAUd,KAAK;EACnCC,MAAM;IACJc,KAAKhB,KAAIC,KAAK,mCAAA;IACdF,MAAM;IACNU,aAAaiC;;;IAGbzB,MAAM;EACR;EACAC,OAAcb,eAAO;IACnB0B,KAAKC,KAAIA,IAAaH,QAAQ,EAAErB,YAAY;MAC1CC,aAAa;IACf,CAAA;IACAkC,OAAcC,cAAMxC,IAAAA,EAAMI,YAAY;MACpCC,aAAa;IACf,CAAA;EACF,CAAA;EACAW,QAAef,eAAO;IACpBwC,YAAmBtC;EACrB,CAAA;EACAc,UAAU;IAACC,SAASC;;AACtB,CAAA;",
|
|
6
|
-
"names": ["Settings", "Schema", "BlueprintsAnnotation", "GraphPropsAnnotation", "DXN", "Annotation", "Obj", "Ref", "Type", "DescriptionAnnotation", "FormInputAnnotation", "LabelAnnotation", "Text", "Schema", "EditorInputMode", "EditorViewMode", "CommentAgentMode", "Union", "Literal", "Settings", "mutable", "Struct", "defaultViewMode", "annotations", "title", "description", "commentAgentMode", "optional", "editorInputMode", "toolbar", "Boolean", "numberedHeadings", "folding", "experimental", "debug", "snippets", "String", "BLUEPRINT_KEY", "Settings", "Document", "Struct", "name", "optional", "String", "description", "fallbackName", "pipe", "FormInputAnnotation", "set", "content", "Ref", "Text", "LabelAnnotation", "DescriptionAnnotation", "Annotation", "IconAnnotation", "icon", "hue", "BlueprintsAnnotation", "GraphPropsAnnotation", "managesAutofocus", "Type", "makeObject", "DXN", "make", "props", "doc", "Obj", "setParent", "target", "Settings", "Schema", "Capability", "meta", "StateSchema", "mutable", "Struct", "viewMode", "Record", "key", "String", "value", "make", "id", "State", "EditorState", "EditorViews", "ExtensionProvider", "AppActivationEvents", "meta", "SetupExtensions", "createStateEvent", "id", "Schema", "Capability", "Operation", "Database", "Ref", "Type", "DXN", "EditorViewMode", "trim", "meta", "makeKey", "name", "DXN", "make", "meta", "id", "Edit", "Struct", "oldString", "String", "annotations", "description", "newString", "replaceAll", "optional", "Boolean", "Create", "Operation", "key", "icon", "input", "content", "output", "services", "Database", "Service", "CreateMarkdown", "Capability", "object", "Type", "getSchema", "Document", "Open", "doc", "Ref", "ScrollToAnchor", "subject", "cursor", "ref", "Void", "SetViewMode", "viewMode", "EditorViewMode", "Update", "trim", "edits", "Array", "newContent"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/navigation-resolver.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities, createTypeSectionPathResolver } from '@dxos/app-toolkit';\n\nimport { Markdown } from '#types';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n return Capability.contributes(\n AppCapabilities.NavigationPathResolver,\n createTypeSectionPathResolver(Markdown.Document),\n );\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,iBAAiBC,qCAAqC;AAE/D,SAASC,gBAAgB;AAEzB,IAAA,8BAAeH,WAAWI,WACjBC,kBAAW,aAAA;AAChB,SAAOL,WAAWM,YAChBL,gBAAgBM,wBAChBL,8BAA8BC,SAASK,QAAQ,CAAA;AAEnD,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Capability", "AppCapabilities", "createTypeSectionPathResolver", "Markdown", "makeModule", "fnUntraced", "contributes", "NavigationPathResolver", "Document"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-surface.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport React, { forwardRef, useCallback, useMemo } from 'react';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport {\n Surface,\n useAtomCapability,\n useAtomCapabilityState,\n useCapabilities,\n useCapability,\n useSettingsState,\n} from '@dxos/app-framework/ui';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { Obj } from '@dxos/echo';\nimport { AttentionCapabilities } from '@dxos/plugin-attention';\nimport { Text } from '@dxos/schema';\nimport { type EditorViewMode } from '@dxos/ui-editor/types';\n\nimport { MarkdownSettings } from '#components';\nimport { MarkdownCard, EditableMarkdownCard, MarkdownArticle, type MarkdownArticleProps } from '#containers';\nimport { meta } from '#meta';\nimport { Markdown, MarkdownCapabilities } from '#types';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Capabilities.ReactSurface, [\n Surface.create({\n id: 'surface.document',\n // TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.\n role: ['article', 'section', 'tabpanel'],\n filter: (data): data is { subject: Markdown.Document; attendableId: string; variant: undefined } =>\n typeof data.attendableId === 'string' && Obj.instanceOf(Markdown.Document, data.subject) && !data.variant,\n component: ({ data, role, ref }) => {\n return (\n <Container\n id={Obj.getURI(data.subject)}\n attendableId={data.attendableId}\n subject={data.subject}\n role={role}\n ref={ref}\n />\n );\n },\n }),\n Surface.create({\n id: 'surface.text',\n // TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.\n // TODO(burdon): Why is attendableId required? See EventArticle.tsx\n filter: AppSurface.oneOf(\n AppSurface.object(AppSurface.Article, Text.Text),\n AppSurface.object(AppSurface.Section, Text.Text),\n AppSurface.object(AppSurface.Tabpanel, Text.Text),\n ),\n component: ({ data, role, ref }) => {\n return (\n <Container\n id={Obj.getURI(data.subject)}\n attendableId={data.attendableId}\n subject={data.subject}\n role={role}\n ref={ref}\n />\n );\n },\n }),\n Surface.create({\n id: 'surface.pluginSettings',\n filter: AppSurface.settings(AppSurface.Article, meta.id),\n component: ({ data: { subject } }) => {\n const { settings, updateSettings } = useSettingsState<Markdown.Settings>(subject.atom);\n return <MarkdownSettings settings={settings} onSettingsChange={updateSettings} />;\n },\n }),\n Surface.create({\n id: 'surface.editable',\n position: 'first',\n filter: AppSurface.object(AppSurface.Card, [Markdown.Document, Text.Text], (data) => data.editable === true),\n component: ({ data }) => <EditableMarkdownCard subject={data.subject} />,\n }),\n Surface.create({\n id: 'surface.preview',\n filter: AppSurface.object(AppSurface.Card, [Markdown.Document, Text.Text], (data) => data.editable !== true),\n component: ({ data }) => <MarkdownCard {...data} />,\n }),\n ]),\n ),\n);\n\n/**\n * Common wrapper.\n */\nconst Container = forwardRef<\n HTMLDivElement,\n AppSurface.ObjectArticleProps<Markdown.Document | Text.Text, { id: string }>\n>(({ id, attendableId, subject, role }, forwardedRef) => {\n const selectionManager = useCapability(AttentionCapabilities.Selection);\n const settings = useAtomCapability(MarkdownCapabilities.Settings);\n const [state, setState] = useAtomCapabilityState(MarkdownCapabilities.State);\n const editorState = useCapability(MarkdownCapabilities.EditorState);\n const extensions = useCapabilities(MarkdownCapabilities.ExtensionProvider);\n const extensionProviders = useMemo(() => extensions.flat(), [extensions]);\n\n const viewMode: EditorViewMode = (id && state.viewMode[id]) || settings?.defaultViewMode || 'source';\n const handleViewModeChange = useCallback<NonNullable<MarkdownArticleProps['onViewModeChange']>>(\n (mode) => setState((current) => ({ ...current, viewMode: { ...current.viewMode, [id]: mode } })),\n [id, setState],\n );\n\n return (\n <MarkdownArticle\n role={role}\n subject={subject}\n id={id}\n attendableId={attendableId}\n settings={settings}\n selectionManager={selectionManager}\n extensionProviders={extensionProviders}\n editorStateStore={editorState}\n viewMode={viewMode}\n onViewModeChange={handleViewModeChange}\n ref={forwardedRef}\n />\n );\n});\n"],
|
|
5
|
-
"mappings": ";;;AAIA,YAAYA,YAAY;AACxB,OAAOC,SAASC,YAAYC,aAAaC,eAAe;AAExD,SAASC,cAAcC,kBAAkB;AACzC,SACEC,SACAC,mBACAC,wBACAC,iBACAC,eACAC,wBACK;AACP,SAASC,kBAAkB;AAC3B,SAASC,WAAW;AACpB,SAASC,6BAA6B;AACtC,SAASC,YAAY;AAGrB,SAASC,wBAAwB;AACjC,SAASC,cAAcC,sBAAsBC,uBAAkD;AAC/F,SAASC,YAAY;AACrB,SAASC,UAAUC,4BAA4B;AAE/C,IAAA,wBAAejB,WAAWkB,WAAW,MAC5BC,eACLnB,WAAWoB,YAAYrB,aAAasB,cAAc;EAChDpB,QAAQqB,OAAO;IACbC,IAAI;;IAEJC,MAAM;MAAC;MAAW;MAAW;;IAC7BC,QAAQ,CAACC,SACP,OAAOA,KAAKC,iBAAiB,YAAYnB,IAAIoB,WAAWZ,SAASa,UAAUH,KAAKI,OAAO,KAAK,CAACJ,KAAKK;IACpGC,WAAW,CAAC,EAAEN,MAAMF,MAAMS,IAAG,MAAE;AAC7B,aACE,sBAAA,cAACC,WAAAA;QACCX,IAAIf,IAAI2B,OAAOT,KAAKI,OAAO;QAC3BH,cAAcD,KAAKC;QACnBG,SAASJ,KAAKI;QACdN;QACAS;;IAGN;EACF,CAAA;EACAhC,QAAQqB,OAAO;IACbC,IAAI;;;IAGJE,QAAQlB,WAAW6B,MACjB7B,WAAW8B,OAAO9B,WAAW+B,SAAS5B,KAAKA,IAAI,GAC/CH,WAAW8B,OAAO9B,WAAWgC,SAAS7B,KAAKA,IAAI,GAC/CH,WAAW8B,O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AAQ;AAChE,QAAM,CAACC,OAAOC,QAAAA,IAAYlD,uBAAuBc,qBAAqBqC,KAAK;AAC3E,QAAMC,cAAclD,cAAcY,qBAAqBuC,WAAW;AAClE,QAAMC,aAAarD,gBAAgBa,qBAAqByC,iBAAiB;AACzE,QAAMC,qBAAqB7D,QAAQ,MAAM2D,WAAWG,KAAI,GAAI;IAACH;GAAW;AAExE,QAAMI,WAA4BtC,MAAM6B,MAAMS,SAAStC,EAAAA,KAAQkB,UAAUqB,mBAAmB;AAC5F,QAAMC,uBAAuBlE,YAC3B,CAACmE,SAASX,SAAS,CAACY,aAAa;IAAE,GAAGA;IAASJ,UAAU;MAAE,GAAGI,QAAQJ;MAAU,CAACtC,EAAAA,GAAKyC;IAAK;EAAE,EAAA,GAC7F;IAACzC;IAAI8B;GAAS;AAGhB,SACE,sBAAA,cAACvC,iBAAAA;IACCU;IACAM;IACAP;IACAI;IACAc;IACAQ;IACAU;IACAO,kBAAkBX;IAClBM;IACAM,kBAAkBJ;IAClB9B,KAAKe;;AAGX,CAAA;",
|
|
6
|
-
"names": ["Effect", "React", "forwardRef", "useCallback", "useMemo", "Capabilities", "Capability", "Surface", "useAtomCapability", "useAtomCapabilityState", "useCapabilities", "useCapability", "useSettingsState", "AppSurface", "Obj", "AttentionCapabilities", "Text", "MarkdownSettings", "MarkdownCard", "EditableMarkdownCard", "MarkdownArticle", "meta", "Markdown", "MarkdownCapabilities", "makeModule", "succeed", "contributes", "ReactSurface", "create", "id", "role", "filter", "data", "attendableId", "instanceOf", "Document", "subject", "variant", "component", "ref", "Container", "getURI", "oneOf", "object", "Article", "Section", "Tabpanel", "settings", "updateSettings", "atom", "onSettingsChange", "position", "Card", "editable", "forwardedRef", "selectionManager", "Selection", "Settings", "state", "setState", "State", "editorState", "EditorState", "extensions", "ExtensionProvider", "extensionProviders", "flat", "viewMode", "defaultViewMode", "handleViewModeChange", "mode", "current", "editorStateStore", "onViewModeChange"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/settings.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport { createKvsStore } from '@dxos/effect';\n\nimport { meta } from '#meta';\nimport { Markdown, MarkdownCapabilities } from '#types';\n\nexport default Capability.makeModule(() =>\n Effect.sync(() => {\n const settingsAtom = createKvsStore({\n key: meta.id,\n schema: Markdown.Settings,\n defaultValue: () => ({\n defaultViewMode: 'preview' as const,\n toolbar: true,\n numberedHeadings: true,\n folding: true,\n experimental: false,\n }),\n });\n\n return [\n Capability.contributes(MarkdownCapabilities.Settings, settingsAtom),\n Capability.contributes(AppCapabilities.Settings, {\n prefix: meta.id,\n schema: Markdown.Settings,\n atom: settingsAtom,\n }),\n ];\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,uBAAuB;AAChC,SAASC,sBAAsB;AAE/B,SAASC,YAAY;AACrB,SAASC,UAAUC,4BAA4B;AAE/C,IAAA,mBAAeL,WAAWM,WAAW,MAC5BC,YAAK,MAAA;AACV,QAAMC,eAAeN,eAAe;IAClCO,KAAKN,KAAKO;IACVC,QAAQP,SAASQ;IACjBC,cAAc,OAAO;MACnBC,iBAAiB;MACjBC,SAAS;MACTC,kBAAkB;MAClBC,SAAS;MACTC,cAAc;IAChB;EACF,CAAA;AAEA,SAAO;IACLlB,WAAWmB,YAAYd,qBAAqBO,UAAUJ,YAAAA;IACtDR,WAAWmB,YAAYlB,gBAAgBW,UAAU;MAC/CQ,QAAQjB,KAAKO;MACbC,QAAQP,SAASQ;MACjBS,MAAMb;IACR,CAAA;;AAEJ,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Capability", "AppCapabilities", "createKvsStore", "meta", "Markdown", "MarkdownCapabilities", "makeModule", "sync", "settingsAtom", "key", "id", "schema", "Settings", "defaultValue", "defaultViewMode", "toolbar", "numberedHeadings", "folding", "experimental", "contributes", "prefix", "atom"]
|
|
7
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
-
|
|
3
|
-
// src/capabilities/state.ts
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
|
-
import { Capability } from "@dxos/app-framework";
|
|
6
|
-
import { createKvsStore } from "@dxos/effect";
|
|
7
|
-
import { createEditorStateStore } from "@dxos/ui-editor";
|
|
8
|
-
import { meta } from "#meta";
|
|
9
|
-
import { MarkdownCapabilities } from "#types";
|
|
10
|
-
var createEditorViewRegistry = () => {
|
|
11
|
-
const views = /* @__PURE__ */ new Map();
|
|
12
|
-
return {
|
|
13
|
-
register: (attendableId, view, documentId) => {
|
|
14
|
-
views.set(attendableId, {
|
|
15
|
-
view,
|
|
16
|
-
documentId
|
|
17
|
-
});
|
|
18
|
-
},
|
|
19
|
-
unregister: (attendableId) => {
|
|
20
|
-
views.delete(attendableId);
|
|
21
|
-
},
|
|
22
|
-
get: (attendableId) => views.get(attendableId)
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
var state_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
26
|
-
const stateAtom = createKvsStore({
|
|
27
|
-
key: `${meta.id}.state`,
|
|
28
|
-
schema: MarkdownCapabilities.StateSchema,
|
|
29
|
-
defaultValue: () => ({
|
|
30
|
-
viewMode: {}
|
|
31
|
-
})
|
|
32
|
-
});
|
|
33
|
-
const editorState = createEditorStateStore(`${meta.id}.editor`);
|
|
34
|
-
const editorViews = createEditorViewRegistry();
|
|
35
|
-
return [
|
|
36
|
-
Capability.contributes(MarkdownCapabilities.State, stateAtom),
|
|
37
|
-
Capability.contributes(MarkdownCapabilities.EditorState, editorState),
|
|
38
|
-
Capability.contributes(MarkdownCapabilities.EditorViews, editorViews)
|
|
39
|
-
];
|
|
40
|
-
}));
|
|
41
|
-
export {
|
|
42
|
-
state_default as default
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=state-5COCF5PN.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/state.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { createKvsStore } from '@dxos/effect';\nimport { createEditorStateStore } from '@dxos/ui-editor';\n\nimport { meta } from '#meta';\nimport { MarkdownCapabilities } from '#types';\n\nconst createEditorViewRegistry = (): MarkdownCapabilities.EditorViewRegistry => {\n const views = new Map<string, MarkdownCapabilities.EditorViewEntry>();\n return {\n register: (attendableId, view, documentId) => {\n views.set(attendableId, { view, documentId });\n },\n unregister: (attendableId) => {\n views.delete(attendableId);\n },\n get: (attendableId) => views.get(attendableId),\n };\n};\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n // Persisted state using KVS store.\n const stateAtom = createKvsStore({\n key: `${meta.id}.state`,\n schema: MarkdownCapabilities.StateSchema,\n defaultValue: () => ({ viewMode: {} }),\n });\n\n // TODO(wittjosiah): Fold into state.\n const editorState = createEditorStateStore(`${meta.id}.editor`);\n\n const editorViews = createEditorViewRegistry();\n\n return [\n Capability.contributes(MarkdownCapabilities.State, stateAtom),\n Capability.contributes(MarkdownCapabilities.EditorState, editorState),\n Capability.contributes(MarkdownCapabilities.EditorViews, editorViews),\n ];\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,sBAAsB;AAC/B,SAASC,8BAA8B;AAEvC,SAASC,YAAY;AACrB,SAASC,4BAA4B;AAErC,IAAMC,2BAA2B,MAAA;AAC/B,QAAMC,QAAQ,oBAAIC,IAAAA;AAClB,SAAO;IACLC,UAAU,CAACC,cAAcC,MAAMC,eAAAA;AAC7BL,YAAMM,IAAIH,cAAc;QAAEC;QAAMC;MAAW,CAAA;IAC7C;IACAE,YAAY,CAACJ,iBAAAA;AACXH,YAAMQ,OAAOL,YAAAA;IACf;IACAM,KAAK,CAACN,iBAAiBH,MAAMS,IAAIN,YAAAA;EACnC;AACF;AAEA,IAAA,gBAAeT,WAAWgB,WACjBC,kBAAW,aAAA;AAEhB,QAAMC,YAAYjB,eAAe;IAC/BkB,KAAK,GAAGhB,KAAKiB,EAAE;IACfC,QAAQjB,qBAAqBkB;IAC7BC,cAAc,OAAO;MAAEC,UAAU,CAAC;IAAE;EACtC,CAAA;AAGA,QAAMC,cAAcvB,uBAAuB,GAAGC,KAAKiB,EAAE,SAAS;AAE9D,QAAMM,cAAcrB,yBAAAA;AAEpB,SAAO;IACLL,WAAW2B,YAAYvB,qBAAqBwB,OAAOV,SAAAA;IACnDlB,WAAW2B,YAAYvB,qBAAqByB,aAAaJ,WAAAA;IACzDzB,WAAW2B,YAAYvB,qBAAqB0B,aAAaJ,WAAAA;;AAE7D,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Capability", "createKvsStore", "createEditorStateStore", "meta", "MarkdownCapabilities", "createEditorViewRegistry", "views", "Map", "register", "attendableId", "view", "documentId", "set", "unregister", "delete", "get", "makeModule", "fnUntraced", "stateAtom", "key", "id", "schema", "StateSchema", "defaultValue", "viewMode", "editorState", "editorViews", "contributes", "State", "EditorState", "EditorViews"]
|
|
7
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability } from '@dxos/app-framework';
|
|
3
|
-
declare const _default: (props: void) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<import("@dxos/app-toolkit").NodeSerializer[]>>, never, Capability.Service>;
|
|
4
|
-
export default _default;
|
|
5
|
-
//# sourceMappingURL=app-graph-serializer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app-graph-serializer.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/app-graph-serializer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAgB,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
import * as Option from 'effect/Option';
|
|
7
|
-
|
|
8
|
-
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
-
import { AppCapabilities, RootCollectionAnnotation } from '@dxos/app-toolkit';
|
|
10
|
-
import { Annotation, Collection, Obj, Type } from '@dxos/echo';
|
|
11
|
-
import { SpaceOperation } from '@dxos/plugin-space';
|
|
12
|
-
import { isSpace } from '@dxos/react-client/echo';
|
|
13
|
-
|
|
14
|
-
import { translations } from '#translations';
|
|
15
|
-
import { MarkdownOperation } from '#types';
|
|
16
|
-
import { Markdown } from '#types';
|
|
17
|
-
|
|
18
|
-
export default Capability.makeModule(
|
|
19
|
-
Effect.fnUntraced(function* () {
|
|
20
|
-
// Get context for lazy capability access in callbacks.
|
|
21
|
-
const capabilities = yield* Capability.Service;
|
|
22
|
-
|
|
23
|
-
return Capability.contributes(AppCapabilities.AppGraphSerializer, [
|
|
24
|
-
{
|
|
25
|
-
inputType: Type.getTypename(Markdown.Document),
|
|
26
|
-
outputType: 'text/markdown',
|
|
27
|
-
// Reconcile with metadata serializers.
|
|
28
|
-
serialize: async (node) => {
|
|
29
|
-
const doc = node.data;
|
|
30
|
-
const content = await doc.content.load();
|
|
31
|
-
return {
|
|
32
|
-
name:
|
|
33
|
-
doc.name ||
|
|
34
|
-
doc.fallbackName ||
|
|
35
|
-
translations[0]['en-US'][Type.getTypename(Markdown.Document)]['object-name.placeholder'],
|
|
36
|
-
data: content.content,
|
|
37
|
-
type: 'text/markdown',
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
deserialize: async (data, ancestors) => {
|
|
41
|
-
const space = ancestors.find(isSpace);
|
|
42
|
-
const target =
|
|
43
|
-
ancestors.findLast((ancestor) => Obj.instanceOf(Collection.Collection, ancestor)) ??
|
|
44
|
-
(space && Annotation.get(space.properties, RootCollectionAnnotation).pipe(Option.getOrUndefined)?.target);
|
|
45
|
-
if (!space || !target) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const { invokePromise } = capabilities.get(Capabilities.OperationInvoker);
|
|
50
|
-
const createResult = await invokePromise(MarkdownOperation.CreateMarkdown, {
|
|
51
|
-
name: data.name,
|
|
52
|
-
content: data.data,
|
|
53
|
-
});
|
|
54
|
-
if (!createResult.data?.object) {
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
await invokePromise(SpaceOperation.AddObject, { target, object: createResult.data.object });
|
|
58
|
-
|
|
59
|
-
return createResult.data.object;
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
]);
|
|
63
|
-
}),
|
|
64
|
-
);
|
|
File without changes
|
|
File without changes
|
/package/dist/lib/neutral/{create-markdown-7MLE625M.mjs.map → create-markdown-KLSVQCT7.mjs.map}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/lib/neutral/{scroll-to-anchor-GAFB7W55.mjs.map → scroll-to-anchor-ACND3WJU.mjs.map}
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/lib/neutral/{update-markdown-NNINDDV5.mjs.map → update-markdown-FGVN3LD4.mjs.map}
RENAMED
|
File without changes
|