@dxos/plugin-markdown 0.8.4-main.21d9917 → 0.8.4-main.2244d791bb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/MarkdownCard-Z6PWYEHJ.mjs +11 -0
- package/dist/lib/browser/MarkdownContainer-KGEX4KEN.mjs +11 -0
- package/dist/lib/browser/{anchor-sort-WQ3TL7ZI.mjs → anchor-sort-QCUZGON5.mjs} +5 -4
- package/dist/lib/browser/anchor-sort-QCUZGON5.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-serializer-ULZUJKOD.mjs → app-graph-serializer-6NGPRTY6.mjs} +7 -6
- package/dist/lib/browser/app-graph-serializer-6NGPRTY6.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-HYSNAH6Z.mjs +17 -0
- package/dist/lib/browser/blueprint-definition-HYSNAH6Z.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +4 -4
- package/dist/lib/browser/{chunk-BX73DASG.mjs → chunk-IKUJPKAE.mjs} +130 -36
- package/dist/lib/browser/chunk-IKUJPKAE.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JOXYQLKH.mjs → chunk-JODBECJA.mjs} +5 -3
- package/dist/lib/browser/chunk-JODBECJA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CUGDX7KA.mjs → chunk-KW4FLYZS.mjs} +2 -2
- package/dist/lib/browser/{chunk-FWQQW6KU.mjs → chunk-LIZX2OAT.mjs} +72 -38
- package/dist/lib/browser/chunk-LIZX2OAT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VQ3WOAB6.mjs → chunk-LRRS3L7O.mjs} +7 -9
- package/dist/lib/browser/chunk-LRRS3L7O.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LMO5UVKL.mjs → chunk-PV7GW7CI.mjs} +3 -4
- package/dist/lib/browser/{chunk-LMO5UVKL.mjs.map → chunk-PV7GW7CI.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-KDKXFKDN.mjs → chunk-YZKNND37.mjs} +8 -7
- package/dist/lib/browser/chunk-YZKNND37.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +11 -10
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/index.mjs +45 -42
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{operation-resolver-EGCWOQKJ.mjs → operation-resolver-EHCL5OS7.mjs} +5 -5
- package/dist/lib/browser/operation-resolver-EHCL5OS7.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-64FZ7T7F.mjs → react-surface-SQVRMKCQ.mjs} +27 -27
- package/dist/lib/browser/react-surface-SQVRMKCQ.mjs.map +7 -0
- package/dist/lib/browser/{settings-JY5JE7MI.mjs → settings-4DDC3NMP.mjs} +5 -4
- package/dist/lib/browser/settings-4DDC3NMP.mjs.map +7 -0
- package/dist/lib/browser/{state-QE7VSJWJ.mjs → state-UIZ3X7RA.mjs} +2 -2
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/{MarkdownCard-GMNXUWWR.mjs → MarkdownCard-NUGJRT43.mjs} +4 -5
- package/dist/lib/node-esm/{MarkdownContainer-LUSMORP2.mjs → MarkdownContainer-6D7OHAZA.mjs} +4 -5
- package/dist/lib/node-esm/{anchor-sort-G7D5TAI6.mjs → anchor-sort-ABOJXSU6.mjs} +5 -4
- package/dist/lib/node-esm/anchor-sort-ABOJXSU6.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-serializer-W5YMQP7P.mjs → app-graph-serializer-OYKI3LW2.mjs} +7 -6
- package/dist/lib/node-esm/app-graph-serializer-OYKI3LW2.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-SOC744SQ.mjs +18 -0
- package/dist/lib/node-esm/blueprint-definition-SOC744SQ.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +4 -4
- package/dist/lib/node-esm/{chunk-KXEQCFMB.mjs → chunk-A5WB5WP7.mjs} +7 -9
- package/dist/lib/node-esm/chunk-A5WB5WP7.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-EYAFC4N7.mjs → chunk-BMKFZ5WK.mjs} +72 -38
- package/dist/lib/node-esm/chunk-BMKFZ5WK.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-W3IIKDV5.mjs → chunk-GXEX67UI.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-PRV35A7Z.mjs → chunk-KG7JF7PJ.mjs} +3 -4
- package/dist/lib/node-esm/{chunk-PRV35A7Z.mjs.map → chunk-KG7JF7PJ.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-44VJC3QF.mjs → chunk-PPGVKPFP.mjs} +5 -3
- package/dist/lib/node-esm/chunk-PPGVKPFP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3JYPCC7M.mjs → chunk-U4W25KQQ.mjs} +8 -7
- package/dist/lib/node-esm/chunk-U4W25KQQ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-D4BCFPKK.mjs → chunk-WJRTAU55.mjs} +130 -36
- package/dist/lib/node-esm/chunk-WJRTAU55.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +11 -10
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/index.mjs +45 -42
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{operation-resolver-2HIS2AQZ.mjs → operation-resolver-ILDFG244.mjs} +5 -5
- package/dist/lib/node-esm/operation-resolver-ILDFG244.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-PKEVHTJK.mjs → react-surface-5DVOPYF3.mjs} +27 -27
- package/dist/lib/node-esm/react-surface-5DVOPYF3.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-4UGMPIRY.mjs → settings-MHB4FPJU.mjs} +5 -4
- package/dist/lib/node-esm/settings-MHB4FPJU.mjs.map +7 -0
- package/dist/lib/node-esm/{state-LXE5XIN4.mjs → state-B2JSHJKS.mjs} +2 -2
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/index.d.ts +41 -3
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/open.d.ts +8 -1
- package/dist/types/src/blueprints/functions/open.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/update.d.ts +16 -3
- package/dist/types/src/blueprints/functions/update.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +1 -1
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/markdown-blueprint.d.ts +3 -20
- package/dist/types/src/blueprints/markdown-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +3 -2
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +1 -1
- package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts +2 -2
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +3 -7
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +1 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings/index.d.ts +1 -1
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +3 -2
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -1
- package/dist/types/src/cli/plugin.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.d.ts +1 -1
- package/dist/types/src/components/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +29 -0
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts +2 -2
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.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/hooks/useExtensions.d.ts +2 -2
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +29 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownAction.d.ts +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +66 -59
- package/src/MarkdownPlugin.tsx +26 -25
- package/src/blueprints/functions/create.conversations.json +1 -1
- package/src/blueprints/functions/create.test.ts +23 -56
- package/src/blueprints/functions/create.ts +3 -2
- package/src/blueprints/functions/index.ts +11 -3
- package/src/blueprints/functions/open.ts +9 -9
- package/src/blueprints/functions/update.conversations.json +1 -1
- package/src/blueprints/functions/update.test.ts +132 -66
- package/src/blueprints/functions/update.ts +53 -12
- package/src/blueprints/index.ts +1 -1
- package/src/blueprints/markdown-blueprint.ts +14 -6
- package/src/capabilities/anchor-sort/anchor-sort.ts +3 -2
- package/src/capabilities/app-graph-serializer/app-graph-serializer.ts +4 -3
- package/src/capabilities/artifact-definition/artifact-definition.ts +2 -2
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +6 -14
- package/src/capabilities/operation-resolver/operation-resolver.ts +3 -3
- package/src/capabilities/react-surface/react-surface.tsx +12 -10
- package/src/capabilities/settings/settings.ts +3 -2
- package/src/cli/plugin.ts +5 -4
- package/src/components/MarkdownCard/MarkdownCard.stories.tsx +1 -1
- package/src/components/MarkdownCard/MarkdownCard.tsx +7 -5
- package/src/components/MarkdownContainer.stories.tsx +5 -5
- package/src/components/MarkdownContainer.tsx +6 -4
- package/src/components/MarkdownEditor/FileUpload.tsx +2 -2
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +2 -2
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +17 -11
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +2 -2
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +24 -24
- package/src/components/Suggestions.stories.tsx +3 -3
- package/src/hooks/useExtensions.tsx +5 -4
- package/src/hooks/useLinkQuery.ts +3 -3
- package/src/hooks/useSelectCurrentThread.tsx +3 -3
- package/src/index.ts +2 -0
- package/src/testing.ts +1 -1
- package/src/translations.ts +2 -0
- package/src/types/events.ts +3 -2
- package/dist/lib/browser/MarkdownCard-HFNNE4B4.mjs +0 -12
- package/dist/lib/browser/MarkdownContainer-V7EAADMF.mjs +0 -12
- package/dist/lib/browser/anchor-sort-WQ3TL7ZI.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-ULZUJKOD.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs +0 -19
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs.map +0 -7
- package/dist/lib/browser/chunk-BX73DASG.mjs.map +0 -7
- package/dist/lib/browser/chunk-FWQQW6KU.mjs.map +0 -7
- package/dist/lib/browser/chunk-JOXYQLKH.mjs.map +0 -7
- package/dist/lib/browser/chunk-KDKXFKDN.mjs.map +0 -7
- package/dist/lib/browser/chunk-S45ULIOG.mjs +0 -101
- package/dist/lib/browser/chunk-S45ULIOG.mjs.map +0 -7
- package/dist/lib/browser/chunk-VQ3WOAB6.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-EGCWOQKJ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-64FZ7T7F.mjs.map +0 -7
- package/dist/lib/browser/settings-JY5JE7MI.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-G7D5TAI6.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-W5YMQP7P.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs +0 -20
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-44VJC3QF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-D4BCFPKK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EYAFC4N7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KXEQCFMB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SDTYEGGL.mjs +0 -102
- package/dist/lib/node-esm/chunk-SDTYEGGL.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-2HIS2AQZ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-PKEVHTJK.mjs.map +0 -7
- package/dist/lib/node-esm/settings-4UGMPIRY.mjs.map +0 -7
- /package/dist/lib/browser/{MarkdownCard-HFNNE4B4.mjs.map → MarkdownCard-Z6PWYEHJ.mjs.map} +0 -0
- /package/dist/lib/browser/{MarkdownContainer-V7EAADMF.mjs.map → MarkdownContainer-KGEX4KEN.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-CUGDX7KA.mjs.map → chunk-KW4FLYZS.mjs.map} +0 -0
- /package/dist/lib/browser/{state-QE7VSJWJ.mjs.map → state-UIZ3X7RA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownCard-GMNXUWWR.mjs.map → MarkdownCard-NUGJRT43.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownContainer-LUSMORP2.mjs.map → MarkdownContainer-6D7OHAZA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-W3IIKDV5.mjs.map → chunk-GXEX67UI.mjs.map} +0 -0
- /package/dist/lib/node-esm/{state-LXE5XIN4.mjs.map → state-B2JSHJKS.mjs.map} +0 -0
|
@@ -6,9 +6,9 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import React, { useMemo } from 'react';
|
|
8
8
|
|
|
9
|
-
import { Common } from '@dxos/app-framework';
|
|
10
|
-
import { Surface, useOperationInvoker } from '@dxos/app-framework/react';
|
|
11
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
11
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
12
12
|
import { Obj, Query } from '@dxos/echo';
|
|
13
13
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
14
14
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
@@ -40,13 +40,13 @@ const DefaultStory = () => {
|
|
|
40
40
|
|
|
41
41
|
useAsyncEffect(async () => {
|
|
42
42
|
if (space) {
|
|
43
|
-
await invokePromise(
|
|
43
|
+
await invokePromise(LayoutOperation.SwitchWorkspace, { subject: space.id });
|
|
44
44
|
}
|
|
45
45
|
}, [space, invokePromise]);
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
48
|
<div className='contents' {...attentionAttrs}>
|
|
49
|
-
<Surface role='article' data={data} limit={1} />
|
|
49
|
+
<Surface.Surface role='article' data={data} limit={1} />
|
|
50
50
|
</div>
|
|
51
51
|
);
|
|
52
52
|
};
|
|
@@ -55,7 +55,7 @@ const meta = {
|
|
|
55
55
|
title: 'plugins/plugin-markdown/MarkdownContainer',
|
|
56
56
|
render: DefaultStory,
|
|
57
57
|
decorators: [
|
|
58
|
-
withTheme,
|
|
58
|
+
withTheme(),
|
|
59
59
|
withLayout({ layout: 'column' }),
|
|
60
60
|
withPluginManager<{ title?: string; content?: string }>((context) => ({
|
|
61
61
|
plugins: [
|
|
@@ -6,13 +6,15 @@ import { type Extension } from '@codemirror/state';
|
|
|
6
6
|
import { Atom } from '@effect-atom/atom-react';
|
|
7
7
|
import React, { forwardRef, useMemo } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { useCapabilities } from '@dxos/app-framework/ui';
|
|
10
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
11
|
+
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
12
|
+
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
11
13
|
import { Obj } from '@dxos/echo';
|
|
12
14
|
import { useActionRunner } from '@dxos/plugin-graph';
|
|
13
15
|
import { useObject } from '@dxos/react-client/echo';
|
|
16
|
+
import { Layout } from '@dxos/react-ui';
|
|
14
17
|
import { type SelectionManager } from '@dxos/react-ui-attention';
|
|
15
|
-
import { Layout } from '@dxos/react-ui-mosaic';
|
|
16
18
|
import { Text } from '@dxos/schema';
|
|
17
19
|
|
|
18
20
|
import { useLinkQuery } from '../hooks';
|
|
@@ -73,7 +75,7 @@ export const MarkdownContainer = forwardRef<HTMLDivElement, MarkdownContainerPro
|
|
|
73
75
|
}, [graph]);
|
|
74
76
|
|
|
75
77
|
// File upload.
|
|
76
|
-
const [upload] = useCapabilities(
|
|
78
|
+
const [upload] = useCapabilities(AppCapabilities.FileUploader);
|
|
77
79
|
const handleFileUpload = useMemo(() => {
|
|
78
80
|
if (!db || !upload) {
|
|
79
81
|
return undefined;
|
|
@@ -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 { type
|
|
10
|
+
import { type FileInfo } from '@dxos/app-toolkit';
|
|
11
11
|
import { addLink } from '@dxos/ui-editor';
|
|
12
12
|
|
|
13
13
|
export const IMAGE_FILES = ['.jpg', '.jpeg', '.png', '.gif'];
|
|
@@ -16,7 +16,7 @@ export type FileUploadAction = () => void;
|
|
|
16
16
|
|
|
17
17
|
export type FileUploadProps = {
|
|
18
18
|
editorView?: EditorView;
|
|
19
|
-
onFileUpload?: (file: File) => Promise<
|
|
19
|
+
onFileUpload?: (file: File) => Promise<FileInfo | undefined>;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
// TODO(burdon): Factor out.
|
|
@@ -11,10 +11,10 @@ import { Filter, Obj } from '@dxos/echo';
|
|
|
11
11
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
12
12
|
import { corePlugins } from '@dxos/plugin-testing';
|
|
13
13
|
import { useQuery, useSpace } from '@dxos/react-client/echo';
|
|
14
|
+
import { Layout } from '@dxos/react-ui';
|
|
14
15
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
16
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
16
17
|
import { translations as editorTranslations } from '@dxos/react-ui-editor';
|
|
17
|
-
import { Layout } from '@dxos/react-ui-mosaic';
|
|
18
18
|
|
|
19
19
|
import { translations } from '../../translations';
|
|
20
20
|
import { Markdown } from '../../types';
|
|
@@ -51,7 +51,7 @@ const meta: Meta<typeof DefaultStory> = {
|
|
|
51
51
|
component: DefaultStory,
|
|
52
52
|
render: DefaultStory as any,
|
|
53
53
|
decorators: [
|
|
54
|
-
withTheme,
|
|
54
|
+
withTheme(),
|
|
55
55
|
withLayout({ layout: 'column' }),
|
|
56
56
|
withPluginManager({
|
|
57
57
|
plugins: [
|
|
@@ -9,7 +9,7 @@ import { createContext } from '@radix-ui/react-context';
|
|
|
9
9
|
import React, { type PropsWithChildren, useMemo, useState } from 'react';
|
|
10
10
|
import { createPortal } from 'react-dom';
|
|
11
11
|
|
|
12
|
-
import { Surface } from '@dxos/app-framework/
|
|
12
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
13
13
|
import { DXN } from '@dxos/keys';
|
|
14
14
|
import { useClient } from '@dxos/react-client';
|
|
15
15
|
import {
|
|
@@ -92,7 +92,7 @@ const MarkdownEditorRoot = ({
|
|
|
92
92
|
setPreviewBlocks((prev) => [...prev, block]);
|
|
93
93
|
},
|
|
94
94
|
removeBlockContainer: ({ link }) => {
|
|
95
|
-
setPreviewBlocks((prev) => prev.filter(({ link: prevLink }) => prevLink.
|
|
95
|
+
setPreviewBlocks((prev) => prev.filter(({ link: prevLink }) => prevLink.dxn !== link.dxn));
|
|
96
96
|
},
|
|
97
97
|
}),
|
|
98
98
|
[],
|
|
@@ -148,6 +148,8 @@ MarkdownEditorRoot.displayName = 'MarkdownEditor.Root';
|
|
|
148
148
|
// MarkdownEditor.Main
|
|
149
149
|
//
|
|
150
150
|
|
|
151
|
+
const MARKDOWN_EDITOR_CONTENT_NAME = 'MarkdownEditor.Content';
|
|
152
|
+
|
|
151
153
|
type MarkdownEditorContentProps = Omit<NaturalMarkdownEditorContentProps, 'id' | 'extensions' | 'toolbarState'>;
|
|
152
154
|
|
|
153
155
|
const MarkdownEditorContent = (props: MarkdownEditorContentProps) => {
|
|
@@ -159,7 +161,7 @@ const MarkdownEditorContent = (props: MarkdownEditorContentProps) => {
|
|
|
159
161
|
toolbarState,
|
|
160
162
|
extensions,
|
|
161
163
|
popoverMenu: { groupsRef, ...menuProps },
|
|
162
|
-
} = useMarkdownEditorContext(
|
|
164
|
+
} = useMarkdownEditorContext(MARKDOWN_EDITOR_CONTENT_NAME);
|
|
163
165
|
|
|
164
166
|
return (
|
|
165
167
|
<EditorMenuProvider view={editorView} groups={groupsRef.current} {...menuProps}>
|
|
@@ -175,52 +177,56 @@ const MarkdownEditorContent = (props: MarkdownEditorContentProps) => {
|
|
|
175
177
|
);
|
|
176
178
|
};
|
|
177
179
|
|
|
178
|
-
MarkdownEditorContent.displayName =
|
|
180
|
+
MarkdownEditorContent.displayName = MARKDOWN_EDITOR_CONTENT_NAME;
|
|
179
181
|
|
|
180
182
|
//
|
|
181
183
|
// MarkdownEditor.Toolbar
|
|
182
184
|
//
|
|
183
185
|
|
|
186
|
+
const MARKDOWN_EDITOR_TOOLBAR_NAME = 'MarkdownEditor.Toolbar';
|
|
187
|
+
|
|
184
188
|
type MarkdownEditorToolbarProps = Omit<
|
|
185
189
|
NaturalMarkdownToolbarProps,
|
|
186
190
|
'state' | 'editorView' | 'onAction' | 'onFileUpload' | 'onViewModeChange'
|
|
187
191
|
>;
|
|
188
192
|
|
|
189
193
|
const MarkdownEditorToolbar = (props: MarkdownEditorToolbarProps) => {
|
|
190
|
-
const { toolbarState, ...rootProps } = useMarkdownEditorContext(
|
|
194
|
+
const { toolbarState, ...rootProps } = useMarkdownEditorContext(MARKDOWN_EDITOR_TOOLBAR_NAME);
|
|
191
195
|
|
|
192
196
|
return <NaturalMarkdownToolbar {...props} {...rootProps} state={toolbarState} />;
|
|
193
197
|
};
|
|
194
198
|
|
|
195
|
-
MarkdownEditorToolbar.displayName =
|
|
199
|
+
MarkdownEditorToolbar.displayName = MARKDOWN_EDITOR_TOOLBAR_NAME;
|
|
196
200
|
|
|
197
201
|
//
|
|
198
202
|
// MarkdownEditor.Blocks (embedded objects)
|
|
199
203
|
//
|
|
200
204
|
|
|
205
|
+
const MARKDOWN_EDITOR_BLOCKS_NAME = 'MarkdownEditor.Blocks';
|
|
206
|
+
|
|
201
207
|
type MarkdownEditorBlocksProps = {};
|
|
202
208
|
|
|
203
209
|
const MarkdownEditorBlocks = (_props: MarkdownEditorBlocksProps) => {
|
|
204
|
-
const { previewBlocks } = useMarkdownEditorContext(
|
|
210
|
+
const { previewBlocks } = useMarkdownEditorContext(MARKDOWN_EDITOR_BLOCKS_NAME);
|
|
205
211
|
|
|
206
212
|
return (
|
|
207
213
|
<>
|
|
208
214
|
{previewBlocks.map(({ link, el }) => (
|
|
209
|
-
<PreviewBlock key={link.
|
|
215
|
+
<PreviewBlock key={link.dxn} link={link} el={el} />
|
|
210
216
|
))}
|
|
211
217
|
</>
|
|
212
218
|
);
|
|
213
219
|
};
|
|
214
220
|
|
|
215
|
-
MarkdownEditorBlocks.displayName =
|
|
221
|
+
MarkdownEditorBlocks.displayName = MARKDOWN_EDITOR_BLOCKS_NAME;
|
|
216
222
|
|
|
217
223
|
const PreviewBlock = ({ el, link }: PreviewBlock) => {
|
|
218
224
|
const client = useClient();
|
|
219
|
-
const dxn = DXN.parse(link.
|
|
225
|
+
const dxn = DXN.parse(link.dxn);
|
|
220
226
|
const subject = client.graph.makeRef(dxn).target;
|
|
221
227
|
const data = useMemo(() => ({ subject }), [subject]);
|
|
222
228
|
|
|
223
|
-
return createPortal(<Surface role='card--transclusion' data={data} limit={1} />, el);
|
|
229
|
+
return createPortal(<Surface.Surface role='card--transclusion' data={data} limit={1} />, el);
|
|
224
230
|
};
|
|
225
231
|
|
|
226
232
|
//
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type EditorView } from '@codemirror/view';
|
|
6
6
|
import React, { useCallback, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { type
|
|
8
|
+
import { type FileInfo } from '@dxos/app-toolkit';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
10
10
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
11
11
|
import { EditorToolbar, type EditorToolbarProps } from '@dxos/react-ui-editor';
|
|
@@ -17,7 +17,7 @@ export type MarkdownEditorToolbarProps = ThemedClassName<
|
|
|
17
17
|
{
|
|
18
18
|
id: string;
|
|
19
19
|
editorView?: EditorView;
|
|
20
|
-
onFileUpload?: (file: File) => Promise<
|
|
20
|
+
onFileUpload?: (file: File) => Promise<FileInfo | undefined>;
|
|
21
21
|
} & Pick<EditorToolbarProps, 'role' | 'state' | 'customActions' | 'onAction' | 'onViewModeChange'>
|
|
22
22
|
>;
|
|
23
23
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Input, Select, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import {
|
|
8
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
9
9
|
import { type EditorInputMode, EditorInputModes, type EditorViewMode, EditorViewModes } from '@dxos/ui-editor';
|
|
10
10
|
|
|
11
11
|
import { meta } from '../../meta';
|
|
@@ -21,10 +21,10 @@ export const MarkdownSettings = ({ settings, onSettingsChange }: MarkdownSetting
|
|
|
21
21
|
|
|
22
22
|
// TODO(wittjosiah): Add skill test confirmation for entering vim mode.
|
|
23
23
|
return (
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
<
|
|
24
|
+
<Settings.Root>
|
|
25
|
+
<Settings.Section title={t('settings title', { ns: meta.id })}>
|
|
26
|
+
<Settings.Group>
|
|
27
|
+
<Settings.ItemInput title={t('default view mode label')}>
|
|
28
28
|
<Select.Root
|
|
29
29
|
value={settings.defaultViewMode}
|
|
30
30
|
onValueChange={(value) => {
|
|
@@ -37,7 +37,7 @@ export const MarkdownSettings = ({ settings, onSettingsChange }: MarkdownSetting
|
|
|
37
37
|
<Select.Viewport>
|
|
38
38
|
{EditorViewModes.map((mode) => (
|
|
39
39
|
<Select.Option key={mode} value={mode}>
|
|
40
|
-
{t(`${mode} mode label`, { ns: 'react-ui-editor' })}
|
|
40
|
+
{t(`${mode} mode label`, { ns: '@dxos/react-ui-editor' })}
|
|
41
41
|
</Select.Option>
|
|
42
42
|
))}
|
|
43
43
|
</Select.Viewport>
|
|
@@ -45,9 +45,9 @@ export const MarkdownSettings = ({ settings, onSettingsChange }: MarkdownSetting
|
|
|
45
45
|
</Select.Content>
|
|
46
46
|
</Select.Portal>
|
|
47
47
|
</Select.Root>
|
|
48
|
-
</
|
|
48
|
+
</Settings.ItemInput>
|
|
49
49
|
|
|
50
|
-
<
|
|
50
|
+
<Settings.ItemInput title={t('editor input mode label')}>
|
|
51
51
|
<Select.Root
|
|
52
52
|
value={settings.editorInputMode ?? 'default'}
|
|
53
53
|
onValueChange={(value) => {
|
|
@@ -68,55 +68,55 @@ export const MarkdownSettings = ({ settings, onSettingsChange }: MarkdownSetting
|
|
|
68
68
|
</Select.Content>
|
|
69
69
|
</Select.Portal>
|
|
70
70
|
</Select.Root>
|
|
71
|
-
</
|
|
71
|
+
</Settings.ItemInput>
|
|
72
72
|
|
|
73
|
-
<
|
|
73
|
+
<Settings.ItemInput title={t('settings toolbar label')}>
|
|
74
74
|
<Input.Switch
|
|
75
75
|
checked={settings.toolbar}
|
|
76
76
|
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, toolbar: !!checked }))}
|
|
77
77
|
/>
|
|
78
|
-
</
|
|
78
|
+
</Settings.ItemInput>
|
|
79
79
|
|
|
80
|
-
<
|
|
80
|
+
<Settings.ItemInput title={t('settings numbered headings label')}>
|
|
81
81
|
<Input.Switch
|
|
82
82
|
checked={settings.numberedHeadings}
|
|
83
83
|
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, numberedHeadings: !!checked }))}
|
|
84
84
|
/>
|
|
85
|
-
</
|
|
85
|
+
</Settings.ItemInput>
|
|
86
86
|
|
|
87
|
-
<
|
|
87
|
+
<Settings.ItemInput title={t('settings folding label')}>
|
|
88
88
|
<Input.Switch
|
|
89
89
|
checked={settings.folding}
|
|
90
90
|
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, folding: !!checked }))}
|
|
91
91
|
/>
|
|
92
|
-
</
|
|
92
|
+
</Settings.ItemInput>
|
|
93
93
|
|
|
94
|
-
<
|
|
94
|
+
<Settings.ItemInput title={t('settings experimental label')}>
|
|
95
95
|
<Input.Switch
|
|
96
96
|
checked={settings.experimental}
|
|
97
97
|
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, experimental: !!checked }))}
|
|
98
98
|
/>
|
|
99
|
-
</
|
|
99
|
+
</Settings.ItemInput>
|
|
100
100
|
|
|
101
|
-
<
|
|
101
|
+
<Settings.ItemInput title={t('settings debug label')}>
|
|
102
102
|
<Input.Switch
|
|
103
103
|
checked={settings.debug}
|
|
104
104
|
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, debug: !!checked }))}
|
|
105
105
|
/>
|
|
106
|
-
</
|
|
106
|
+
</Settings.ItemInput>
|
|
107
107
|
|
|
108
108
|
{settings.debug && (
|
|
109
|
-
<
|
|
109
|
+
<Settings.ItemInput title={t('settings debug textarea label', { ns: meta.id })}>
|
|
110
110
|
<Input.TextArea
|
|
111
111
|
rows={5}
|
|
112
112
|
value={settings.typewriter}
|
|
113
113
|
onChange={({ target: { value } }) => onSettingsChange((s) => ({ ...s, typewriter: value }))}
|
|
114
114
|
placeholder={t('settings debug placeholder')}
|
|
115
115
|
/>
|
|
116
|
-
</
|
|
116
|
+
</Settings.ItemInput>
|
|
117
117
|
)}
|
|
118
|
-
</
|
|
119
|
-
</
|
|
120
|
-
</
|
|
118
|
+
</Settings.Group>
|
|
119
|
+
</Settings.Section>
|
|
120
|
+
</Settings.Root>
|
|
121
121
|
);
|
|
122
122
|
};
|
|
@@ -10,8 +10,8 @@ import * as Option from 'effect/Option';
|
|
|
10
10
|
import * as Schema from 'effect/Schema';
|
|
11
11
|
import React, { type FC, useEffect, useMemo, useState } from 'react';
|
|
12
12
|
|
|
13
|
-
import { useAtomCapability, useCapability } from '@dxos/app-framework/react';
|
|
14
13
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
14
|
+
import { useAtomCapability, useCapability } from '@dxos/app-framework/ui';
|
|
15
15
|
import { Obj, Ref, Type } from '@dxos/echo';
|
|
16
16
|
import { createDocAccessor, toCursorRange } from '@dxos/echo-db';
|
|
17
17
|
import { invariant } from '@dxos/invariant';
|
|
@@ -21,9 +21,9 @@ import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
|
21
21
|
import { faker } from '@dxos/random';
|
|
22
22
|
import { useQueue, useSpace } from '@dxos/react-client/echo';
|
|
23
23
|
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
24
|
+
import { Layout } from '@dxos/react-ui';
|
|
24
25
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
25
26
|
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
26
|
-
import { Layout } from '@dxos/react-ui-mosaic';
|
|
27
27
|
import { render } from '@dxos/storybook-utils';
|
|
28
28
|
import { Message } from '@dxos/types';
|
|
29
29
|
import { type EditorSelection, type Range } from '@dxos/ui-editor';
|
|
@@ -154,7 +154,7 @@ const storybook: Meta<typeof DefaultStory> = {
|
|
|
154
154
|
title: 'plugins/plugin-markdown/Suggestions',
|
|
155
155
|
render: render(DefaultStory),
|
|
156
156
|
decorators: [
|
|
157
|
-
withTheme,
|
|
157
|
+
withTheme(),
|
|
158
158
|
withPluginManager({
|
|
159
159
|
plugins: [
|
|
160
160
|
...corePlugins(),
|
|
@@ -6,8 +6,9 @@ import { type ViewUpdate } from '@codemirror/view';
|
|
|
6
6
|
import React, { type AnchorHTMLAttributes, type ReactNode, useMemo } from 'react';
|
|
7
7
|
import { createRoot } from 'react-dom/client';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import { useOperationInvoker } from '@dxos/app-framework/
|
|
9
|
+
import { type Capabilities } from '@dxos/app-framework';
|
|
10
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
11
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
11
12
|
import { debounceAndThrottle } from '@dxos/async';
|
|
12
13
|
import { Obj } from '@dxos/echo';
|
|
13
14
|
import { createDocAccessor } from '@dxos/echo-db';
|
|
@@ -49,7 +50,7 @@ export type DocumentType = Markdown.Document | Text.Text | { id: string; text: s
|
|
|
49
50
|
export type ExtensionsOptions = {
|
|
50
51
|
id: string;
|
|
51
52
|
object?: DocumentType;
|
|
52
|
-
invokePromise?:
|
|
53
|
+
invokePromise?: Capabilities.OperationInvoker['invokePromise'];
|
|
53
54
|
settings?: Markdown.Settings;
|
|
54
55
|
selectionManager?: SelectionManager;
|
|
55
56
|
viewMode?: EditorViewMode;
|
|
@@ -171,7 +172,7 @@ const createBaseExtensions = ({
|
|
|
171
172
|
renderLinkButton:
|
|
172
173
|
invokePromise && (object || id)
|
|
173
174
|
? createLinkRenderer((targetId: string) => {
|
|
174
|
-
void invokePromise(
|
|
175
|
+
void invokePromise(LayoutOperation.Open, {
|
|
175
176
|
subject: [targetId],
|
|
176
177
|
pivotId: object && Obj.isObject(object) ? Obj.getDXN(object).toString() : id,
|
|
177
178
|
});
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import * as Option from 'effect/Option';
|
|
6
6
|
import { useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { usePluginManager } from '@dxos/app-framework/ui';
|
|
9
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
10
10
|
import { type Database, Filter, Obj, Query, Type } from '@dxos/echo';
|
|
11
11
|
import { EntityKind, SystemTypeAnnotation, getTypeAnnotation } from '@dxos/echo/internal';
|
|
12
12
|
import { toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
@@ -19,7 +19,7 @@ export const useLinkQuery = (db: Database.Database | undefined) => {
|
|
|
19
19
|
const manager = usePluginManager();
|
|
20
20
|
const resolve = useCallback(
|
|
21
21
|
(typename: string) =>
|
|
22
|
-
manager.capabilities.getAll(
|
|
22
|
+
manager.capabilities.getAll(AppCapabilities.Metadata).find(({ id }) => id === typename)?.metadata ?? {},
|
|
23
23
|
[manager],
|
|
24
24
|
);
|
|
25
25
|
|
|
@@ -6,8 +6,8 @@ import { EditorView } from '@codemirror/view';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { useOperationResolver } from '@dxos/app-framework/ui';
|
|
10
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
11
11
|
import { invariant } from '@dxos/invariant';
|
|
12
12
|
import { OperationResolver } from '@dxos/operation';
|
|
13
13
|
import { Cursor, setSelection } from '@dxos/ui-editor';
|
|
@@ -21,7 +21,7 @@ export const useSelectCurrentThread = (editorView: EditorView | null, documentId
|
|
|
21
21
|
const scrollIntoViewHandler = useMemo(
|
|
22
22
|
() =>
|
|
23
23
|
OperationResolver.make({
|
|
24
|
-
operation:
|
|
24
|
+
operation: LayoutOperation.ScrollIntoView,
|
|
25
25
|
position: 'hoist',
|
|
26
26
|
filter: (input) => !!editorView && input.subject === documentId && !!input.cursor,
|
|
27
27
|
handler: (input) =>
|
package/src/index.ts
CHANGED
package/src/testing.ts
CHANGED
|
@@ -15,7 +15,7 @@ export const WithProperties = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.
|
|
|
15
15
|
Effect.zipRight(
|
|
16
16
|
Effect.gen(function* () {
|
|
17
17
|
// TODO(wittjosiah): Remove cast.
|
|
18
|
-
yield* Database.
|
|
18
|
+
yield* Database.add(
|
|
19
19
|
Obj.make(SpaceProperties, {
|
|
20
20
|
[Collection.Collection.typename]: Ref.make(Collection.make()),
|
|
21
21
|
}) as any,
|
package/src/translations.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
|
+
import { translations as editorTranslations } from '@dxos/react-ui-editor';
|
|
6
7
|
|
|
7
8
|
import { meta } from './meta';
|
|
8
9
|
import { Markdown } from './types';
|
|
@@ -50,4 +51,5 @@ export const translations = [
|
|
|
50
51
|
},
|
|
51
52
|
},
|
|
52
53
|
},
|
|
54
|
+
...editorTranslations,
|
|
53
55
|
] as const satisfies Resource[];
|
package/src/types/events.ts
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type ActivationEvent
|
|
5
|
+
import { type ActivationEvent } from '@dxos/app-framework';
|
|
6
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
6
7
|
|
|
7
8
|
import { meta } from '../meta';
|
|
8
9
|
|
|
9
10
|
export namespace MarkdownEvents {
|
|
10
|
-
export const SetupExtensions: ActivationEvent.ActivationEvent =
|
|
11
|
+
export const SetupExtensions: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(
|
|
11
12
|
`${meta.id}/event/setup-extensions`,
|
|
12
13
|
);
|
|
13
14
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MarkdownCard,
|
|
3
|
-
MarkdownCard_default
|
|
4
|
-
} from "./chunk-VQ3WOAB6.mjs";
|
|
5
|
-
import "./chunk-BX73DASG.mjs";
|
|
6
|
-
import "./chunk-S45ULIOG.mjs";
|
|
7
|
-
import "./chunk-LMO5UVKL.mjs";
|
|
8
|
-
export {
|
|
9
|
-
MarkdownCard,
|
|
10
|
-
MarkdownCard_default as default
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=MarkdownCard-HFNNE4B4.mjs.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MarkdownContainer,
|
|
3
|
-
MarkdownContainer_default
|
|
4
|
-
} from "./chunk-KDKXFKDN.mjs";
|
|
5
|
-
import "./chunk-BX73DASG.mjs";
|
|
6
|
-
import "./chunk-S45ULIOG.mjs";
|
|
7
|
-
import "./chunk-LMO5UVKL.mjs";
|
|
8
|
-
export {
|
|
9
|
-
MarkdownContainer,
|
|
10
|
-
MarkdownContainer_default as default
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=MarkdownContainer-V7EAADMF.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/anchor-sort/anchor-sort.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability, Common } from '@dxos/app-framework';\nimport { Relation } from '@dxos/echo';\nimport { createDocAccessor, getRangeFromCursor } from '@dxos/echo-db';\nimport { type AnchoredTo } from '@dxos/types';\n\nimport { Markdown } from '../../types';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Common.Capability.AnchorSort, {\n key: Markdown.Document.typename,\n sort: (anchorA: AnchoredTo.AnchoredTo, anchorB: AnchoredTo.AnchoredTo) => {\n const doc = Relation.getTarget(anchorA) as Markdown.Document;\n const accessor = doc.content.target ? createDocAccessor(doc.content.target, ['content']) : undefined;\n if (doc !== Relation.getTarget(anchorB) || !accessor) {\n return 0;\n }\n\n const getStartPosition = (cursor: string | undefined) => {\n const range = cursor ? getRangeFromCursor(accessor, cursor) : undefined;\n return range?.start ?? Number.MAX_SAFE_INTEGER;\n };\n\n const posA = getStartPosition(anchorA.anchor);\n const posB = getStartPosition(anchorB.anchor);\n return posA - posB;\n },\n }),\n ),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,YAAYC,cAAc;AACnC,SAASC,gBAAgB;AACzB,SAASC,mBAAmBC,0BAA0B;AAKtD,IAAA,sBAAeC,WAAWC,WAAW,MAC5BC,eACLF,WAAWG,YAAYC,OAAOJ,WAAWK,YAAY;EACnDC,KAAKC,iBAASC,SAASC;EACvBC,MAAM,CAACC,SAAgCC,YAAAA;AACrC,UAAMC,MAAMC,SAASC,UAAUJ,OAAAA;AAC/B,UAAMK,WAAWH,IAAII,QAAQC,SAASC,kBAAkBN,IAAII,QAAQC,QAAQ;MAAC;KAAU,IAAIE;AAC3F,QAAIP,QAAQC,SAASC,UAAUH,OAAAA,KAAY,CAACI,UAAU;AACpD,aAAO;IACT;AAEA,UAAMK,mBAAmB,CAACC,WAAAA;AACxB,YAAMC,QAAQD,SAASE,mBAAmBR,UAAUM,MAAAA,IAAUF;AAC9D,aAAOG,OAAOE,SAASC,OAAOC;IAChC;AAEA,UAAMC,OAAOP,iBAAiBV,QAAQkB,MAAM;AAC5C,UAAMC,OAAOT,iBAAiBT,QAAQiB,MAAM;AAC5C,WAAOD,OAAOE;EAChB;AACF,CAAA,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Capability", "Common", "Relation", "createDocAccessor", "getRangeFromCursor", "Capability", "makeModule", "succeed", "contributes", "Common", "AnchorSort", "key", "Markdown", "Document", "typename", "sort", "anchorA", "anchorB", "doc", "Relation", "getTarget", "accessor", "content", "target", "createDocAccessor", "undefined", "getStartPosition", "cursor", "range", "getRangeFromCursor", "start", "Number", "MAX_SAFE_INTEGER", "posA", "anchor", "posB"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-serializer/app-graph-serializer.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability, Common } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { SpaceOperation } from '@dxos/plugin-space/types';\nimport { isSpace } from '@dxos/react-client/echo';\nimport { Collection } from '@dxos/schema';\n\nimport { translations } from '../../translations';\nimport { Markdown, MarkdownOperation } 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(Common.Capability.AppGraphSerializer, [\n {\n inputType: Markdown.Document.typename,\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'][Markdown.Document.typename]['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?.properties[Collection.Collection.typename]?.target;\n if (!space || !target) {\n return;\n }\n\n const { invokePromise } = capabilities.get(Common.Capability.OperationInvoker);\n const createResult = await invokePromise(MarkdownOperation.Create, { name: data.name, content: data.data });\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;AAExB,SAASC,YAAYC,cAAc;AACnC,SAASC,WAAW;AACpB,SAASC,sBAAsB;AAC/B,SAASC,eAAe;AACxB,SAASC,kBAAkB;AAK3B,IAAA,+BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAEhB,QAAMC,eAAe,OAAOH,WAAWI;AAEvC,SAAOJ,WAAWK,YAAYC,OAAON,WAAWO,oBAAoB;IAClE;MACEC,WAAWC,iBAASC,SAASC;MAC7BC,YAAY;;MAEZC,WAAW,OAAOC,SAAAA;AAChB,cAAMC,MAAMD,KAAKE;AACjB,cAAMC,UAAU,MAAMF,IAAIE,QAAQC,KAAI;AACtC,eAAO;UACLC,MACEJ,IAAII,QACJJ,IAAIK,gBACJC,aAAa,CAAA,EAAG,OAAA,EAASZ,iBAASC,SAASC,QAAQ,EAAE,yBAAA;UACvDK,MAAMC,QAAQA;UACdK,MAAM;QACR;MACF;MACAC,aAAa,OAAOP,MAAMQ,cAAAA;AACxB,cAAMC,QAAQD,UAAUE,KAAKC,OAAAA;AAC7B,cAAMC,SACJJ,UAAUK,SAAS,CAACC,aAAaC,IAAIC,WAAWC,WAAWA,YAAYH,QAAAA,CAAAA,KACvEL,OAAOS,WAAWD,WAAWA,WAAWtB,QAAQ,GAAGiB;AACrD,YAAI,CAACH,SAAS,CAACG,QAAQ;AACrB;QACF;AAEA,cAAM,EAAEO,cAAa,IAAKhC,aAAaiC,IAAI9B,OAAON,WAAWqC,gBAAgB;AAC7E,cAAMC,eAAe,MAAMH,cAAcI,kBAAkBC,QAAQ;UAAErB,MAAMH,KAAKG;UAAMF,SAASD,KAAKA;QAAK,CAAA;AACzG,YAAI,CAACsB,aAAatB,MAAMyB,QAAQ;AAC9B,iBAAOC;QACT;AACA,cAAMP,cAAcQ,eAAeC,WAAW;UAAEhB;UAAQa,QAAQH,aAAatB,KAAKyB;QAAO,CAAA;AAEzF,eAAOH,aAAatB,KAAKyB;MAC3B;IACF;GACD;AACH,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Capability", "Common", "Obj", "SpaceOperation", "isSpace", "Collection", "Capability", "makeModule", "fnUntraced", "capabilities", "Service", "contributes", "Common", "AppGraphSerializer", "inputType", "Markdown", "Document", "typename", "outputType", "serialize", "node", "doc", "data", "content", "load", "name", "fallbackName", "translations", "type", "deserialize", "ancestors", "space", "find", "isSpace", "target", "findLast", "ancestor", "Obj", "instanceOf", "Collection", "properties", "invokePromise", "get", "OperationInvoker", "createResult", "MarkdownOperation", "Create", "object", "undefined", "SpaceOperation", "AddObject"]
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
markdown_blueprint_exports
|
|
3
|
-
} from "./chunk-FWQQW6KU.mjs";
|
|
4
|
-
import "./chunk-LMO5UVKL.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/blueprint-definition/blueprint-definition.ts
|
|
7
|
-
import * as Effect from "effect/Effect";
|
|
8
|
-
import { Capability, Common } from "@dxos/app-framework";
|
|
9
|
-
var functions = markdown_blueprint_exports.functions;
|
|
10
|
-
var blueprintDefinition = Capability.makeModule(() => Effect.succeed([
|
|
11
|
-
Capability.contributes(Common.Capability.Functions, functions),
|
|
12
|
-
Capability.contributes(Common.Capability.BlueprintDefinition, markdown_blueprint_exports.make())
|
|
13
|
-
]));
|
|
14
|
-
var blueprint_definition_default = blueprintDefinition;
|
|
15
|
-
export {
|
|
16
|
-
blueprint_definition_default as default,
|
|
17
|
-
functions
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=blueprint-definition-TLV4PNZW.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/blueprint-definition/blueprint-definition.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability, Common } from '@dxos/app-framework';\n\nimport { MarkdownBlueprint } from '../../blueprints';\n\nexport const functions = MarkdownBlueprint.functions;\n\nexport type BlueprintCapabilities = [\n Capability.Capability<typeof Common.Capability.Functions>,\n Capability.Capability<typeof Common.Capability.BlueprintDefinition>,\n];\n\nconst blueprintDefinition = Capability.makeModule<[], BlueprintCapabilities>(() =>\n Effect.succeed([\n Capability.contributes(Common.Capability.Functions, functions),\n Capability.contributes(Common.Capability.BlueprintDefinition, MarkdownBlueprint.make()),\n ]),\n);\n\nexport default blueprintDefinition;\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,YAAYC,cAAc;AAI5B,IAAMC,YAAYC,2BAAkBD;AAO3C,IAAME,sBAAsBC,WAAWC,WAAsC,MACpEC,eAAQ;EACbF,WAAWG,YAAYC,OAAOJ,WAAWK,WAAWR,SAAAA;EACpDG,WAAWG,YAAYC,OAAOJ,WAAWM,qBAAqBR,2BAAkBS,KAAI,CAAA;CACrF,CAAA;AAGH,IAAA,+BAAeR;",
|
|
6
|
-
"names": ["Effect", "Capability", "Common", "functions", "MarkdownBlueprint", "blueprintDefinition", "Capability", "makeModule", "succeed", "contributes", "Common", "Functions", "BlueprintDefinition", "make"]
|
|
7
|
-
}
|