@dxos/plugin-markdown 0.8.4-main.c1de068 → 0.8.4-main.c4373fc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{MarkdownPreview-S3C7CGAV.mjs → MarkdownCard-ZHTH6EVA.mjs} +18 -18
- package/dist/lib/browser/MarkdownCard-ZHTH6EVA.mjs.map +7 -0
- package/dist/lib/browser/{MarkdownContainer-F3WEEIBX.mjs → MarkdownContainer-XDYFBDCI.mjs} +287 -315
- package/dist/lib/browser/MarkdownContainer-XDYFBDCI.mjs.map +7 -0
- package/dist/lib/browser/{anchor-sort-UKJJ7ZNP.mjs → anchor-sort-53E7TJGF.mjs} +7 -7
- package/dist/lib/browser/anchor-sort-53E7TJGF.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-serializer-ICLAF662.mjs → app-graph-serializer-IEPNJZBR.mjs} +13 -14
- package/dist/lib/browser/app-graph-serializer-IEPNJZBR.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-XDLVVSUN.mjs +11 -0
- package/dist/lib/browser/blueprint-definition-XDLVVSUN.mjs.map +7 -0
- package/dist/lib/browser/chunk-EVQGTH3P.mjs +22 -0
- package/dist/lib/browser/chunk-EVQGTH3P.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LHDCHDBW.mjs → chunk-NGXGBWSS.mjs} +6 -5
- package/dist/lib/browser/chunk-NGXGBWSS.mjs.map +7 -0
- package/dist/lib/browser/chunk-ODB2PTBP.mjs +28 -0
- package/dist/lib/browser/chunk-ODB2PTBP.mjs.map +7 -0
- package/dist/lib/browser/chunk-OY6CGPOO.mjs +16 -0
- package/dist/lib/browser/chunk-OY6CGPOO.mjs.map +7 -0
- package/dist/lib/browser/chunk-PMBWHKDI.mjs +78 -0
- package/dist/lib/browser/chunk-PMBWHKDI.mjs.map +7 -0
- package/dist/lib/browser/chunk-VZU7BRGW.mjs +106 -0
- package/dist/lib/browser/chunk-VZU7BRGW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LFML7LC6.mjs → chunk-XYQDM6PM.mjs} +8 -9
- package/dist/lib/browser/chunk-XYQDM6PM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +35 -22
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/intent-resolver-66ZUQ6JC.mjs +62 -0
- package/dist/lib/browser/intent-resolver-66ZUQ6JC.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-C3Z423TV.mjs → react-surface-ONX5RNFM.mjs} +55 -46
- package/dist/lib/browser/react-surface-ONX5RNFM.mjs.map +7 -0
- package/dist/lib/browser/{settings-KN75ZQY6.mjs → settings-HXM36BCZ.mjs} +7 -7
- package/dist/lib/browser/settings-HXM36BCZ.mjs.map +7 -0
- package/dist/lib/browser/{state-LZWTAS65.mjs → state-6QODXCSZ.mjs} +9 -9
- package/dist/lib/browser/state-6QODXCSZ.mjs.map +7 -0
- package/dist/lib/browser/toolkit-73U3A7SD.mjs +76 -0
- package/dist/lib/browser/toolkit-73U3A7SD.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +6 -14
- package/dist/lib/node-esm/{MarkdownPreview-77UFEWXT.mjs → MarkdownCard-MEA4QAAI.mjs} +18 -18
- package/dist/lib/node-esm/MarkdownCard-MEA4QAAI.mjs.map +7 -0
- package/dist/lib/node-esm/{MarkdownContainer-VOUHL6IU.mjs → MarkdownContainer-7GYMOJVT.mjs} +287 -315
- package/dist/lib/node-esm/MarkdownContainer-7GYMOJVT.mjs.map +7 -0
- package/dist/lib/node-esm/{anchor-sort-IPIS5D5B.mjs → anchor-sort-V2FWEYDN.mjs} +7 -7
- package/dist/lib/node-esm/anchor-sort-V2FWEYDN.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-serializer-FLBXQKKR.mjs → app-graph-serializer-HIN4NMUG.mjs} +13 -14
- package/dist/lib/node-esm/app-graph-serializer-HIN4NMUG.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-PDXZ67UQ.mjs +12 -0
- package/dist/lib/node-esm/blueprint-definition-PDXZ67UQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-35WAARP4.mjs +79 -0
- package/dist/lib/node-esm/chunk-35WAARP4.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ACFGXH2K.mjs → chunk-CB2R4YIY.mjs} +5 -5
- package/dist/lib/node-esm/chunk-CB2R4YIY.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CWTFQSN7.mjs → chunk-IOC54NCF.mjs} +8 -9
- package/dist/lib/node-esm/chunk-IOC54NCF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VCG2U522.mjs +29 -0
- package/dist/lib/node-esm/chunk-VCG2U522.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VELFUWUH.mjs +107 -0
- package/dist/lib/node-esm/chunk-VELFUWUH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-W4XXBX33.mjs +24 -0
- package/dist/lib/node-esm/chunk-W4XXBX33.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VIR2ABYE.mjs → chunk-YGSNWTGP.mjs} +6 -5
- package/dist/lib/node-esm/chunk-YGSNWTGP.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +35 -22
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/intent-resolver-TNRIFHNH.mjs +63 -0
- package/dist/lib/node-esm/intent-resolver-TNRIFHNH.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-TTTBYNI2.mjs → react-surface-X2GV6WQH.mjs} +55 -46
- package/dist/lib/node-esm/react-surface-X2GV6WQH.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-KVP7TVX7.mjs → settings-KPLQ5ONI.mjs} +7 -7
- package/dist/lib/node-esm/settings-KPLQ5ONI.mjs.map +7 -0
- package/dist/lib/node-esm/{state-NW3W4JCQ.mjs → state-W3PECOJX.mjs} +9 -9
- package/dist/lib/node-esm/state-W3PECOJX.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-GUBDYF72.mjs +77 -0
- package/dist/lib/node-esm/toolkit-GUBDYF72.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +6 -14
- package/dist/types/src/MarkdownPlugin.d.ts +1 -1
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort.d.ts +2 -2
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +1 -9
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +12 -10
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts +2 -2
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts +4 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts +7 -0
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts +9 -0
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownCard/index.d.ts +4 -0
- package/dist/types/src/components/MarkdownCard/index.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownContainer.d.ts +5 -5
- package/dist/types/src/components/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +51 -5
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts +2 -2
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts +111 -13
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts +2 -2
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +1 -1
- package/dist/types/src/components/Suggestions.stories.d.ts +3 -4
- package/dist/types/src/components/Suggestions.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar.stories.d.ts +45 -8
- package/dist/types/src/components/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/extensions.d.ts +3 -5
- package/dist/types/src/extensions.d.ts.map +1 -1
- package/dist/types/src/functions/diff.d.ts +6 -0
- package/dist/types/src/functions/diff.d.ts.map +1 -0
- package/dist/types/src/functions/index.d.ts +3 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/open.d.ts +7 -0
- package/dist/types/src/functions/open.d.ts.map +1 -0
- package/dist/types/src/hooks/useSelectCurrentThread.d.ts +1 -1
- package/dist/types/src/hooks/useSelectCurrentThread.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +43 -0
- package/dist/types/src/types/Markdown.d.ts.map +1 -0
- package/dist/types/src/types/MarkdownAction.d.ts +33 -0
- package/dist/types/src/types/MarkdownAction.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +3 -59
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +12 -3
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +57 -52
- package/src/MarkdownPlugin.tsx +103 -95
- package/src/capabilities/anchor-sort.ts +3 -3
- package/src/capabilities/app-graph-serializer.ts +9 -7
- package/src/capabilities/artifact-definition.ts +20 -24
- package/src/capabilities/blueprint-definition.ts +39 -0
- package/src/capabilities/capabilities.ts +5 -4
- package/src/capabilities/index.ts +3 -1
- package/src/capabilities/intent-resolver.ts +16 -21
- package/src/capabilities/react-surface.tsx +21 -19
- package/src/capabilities/settings.ts +3 -3
- package/src/capabilities/state.ts +8 -8
- package/src/capabilities/toolkit.ts +49 -0
- package/src/components/MarkdownCard/MarkdownCard.stories.tsx +76 -0
- package/src/components/{MarkdownPreview/MarkdownPreview.tsx → MarkdownCard/MarkdownCard.tsx} +13 -11
- package/src/components/MarkdownCard/index.ts +9 -0
- package/src/components/MarkdownContainer.stories.tsx +47 -41
- package/src/components/MarkdownContainer.tsx +22 -19
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +21 -17
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +39 -39
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +81 -78
- package/src/components/Suggestions.stories.tsx +51 -51
- package/src/components/Toolbar.stories.tsx +23 -18
- package/src/components/index.ts +1 -1
- package/src/events.ts +2 -2
- package/src/extensions.tsx +13 -41
- package/src/functions/diff.ts +37 -0
- package/src/functions/index.ts +6 -0
- package/src/functions/open.ts +32 -0
- package/src/hooks/useSelectCurrentThread.tsx +5 -5
- package/src/index.ts +4 -1
- package/src/meta.ts +7 -8
- package/src/translations.ts +3 -2
- package/src/types/Markdown.ts +56 -0
- package/src/types/MarkdownAction.ts +29 -0
- package/src/types/index.ts +2 -1
- package/src/types/types.ts +6 -50
- package/src/util.tsx +20 -6
- package/dist/lib/browser/MarkdownContainer-F3WEEIBX.mjs.map +0 -7
- package/dist/lib/browser/MarkdownPreview-S3C7CGAV.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-UKJJ7ZNP.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-ICLAF662.mjs.map +0 -7
- package/dist/lib/browser/artifact-definition-R2YYWOPN.mjs +0 -145
- package/dist/lib/browser/artifact-definition-R2YYWOPN.mjs.map +0 -7
- package/dist/lib/browser/chunk-777RIED6.mjs +0 -16
- package/dist/lib/browser/chunk-777RIED6.mjs.map +0 -7
- package/dist/lib/browser/chunk-EPTSAJZM.mjs +0 -22
- package/dist/lib/browser/chunk-EPTSAJZM.mjs.map +0 -7
- package/dist/lib/browser/chunk-LFML7LC6.mjs.map +0 -7
- package/dist/lib/browser/chunk-LHDCHDBW.mjs.map +0 -7
- package/dist/lib/browser/chunk-PHTD5DTR.mjs +0 -20
- package/dist/lib/browser/chunk-PHTD5DTR.mjs.map +0 -7
- package/dist/lib/browser/chunk-UANWRJZU.mjs +0 -79
- package/dist/lib/browser/chunk-UANWRJZU.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3MXYO3MW.mjs +0 -64
- package/dist/lib/browser/intent-resolver-3MXYO3MW.mjs.map +0 -7
- package/dist/lib/browser/react-surface-C3Z423TV.mjs.map +0 -7
- package/dist/lib/browser/settings-KN75ZQY6.mjs.map +0 -7
- package/dist/lib/browser/state-LZWTAS65.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-VOUHL6IU.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownPreview-77UFEWXT.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-IPIS5D5B.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-FLBXQKKR.mjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-MLTAY4LK.mjs +0 -146
- package/dist/lib/node-esm/artifact-definition-MLTAY4LK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7X6TPTJK.mjs +0 -22
- package/dist/lib/node-esm/chunk-7X6TPTJK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ACFGXH2K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CWTFQSN7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CXG7GMYP.mjs +0 -24
- package/dist/lib/node-esm/chunk-CXG7GMYP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JEEQLO7C.mjs +0 -80
- package/dist/lib/node-esm/chunk-JEEQLO7C.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VIR2ABYE.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-BZYWV53A.mjs +0 -65
- package/dist/lib/node-esm/intent-resolver-BZYWV53A.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-TTTBYNI2.mjs.map +0 -7
- package/dist/lib/node-esm/settings-KVP7TVX7.mjs.map +0 -7
- package/dist/lib/node-esm/state-NW3W4JCQ.mjs.map +0 -7
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.d.ts +0 -6
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.stories.d.ts +0 -42
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownPreview/index.d.ts +0 -4
- package/dist/types/src/components/MarkdownPreview/index.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -35
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/components/MarkdownPreview/MarkdownPreview.stories.tsx +0 -81
- package/src/components/MarkdownPreview/index.ts +0 -9
- package/src/types/schema.ts +0 -39
|
@@ -3,33 +3,29 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { next as A } from '@automerge/automerge';
|
|
6
|
-
import
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
7
|
+
import type * as Schema from 'effect/Schema';
|
|
7
8
|
|
|
8
9
|
import {
|
|
9
10
|
Capabilities,
|
|
10
11
|
CollaborationActions,
|
|
12
|
+
type PluginContext,
|
|
11
13
|
contributes,
|
|
12
14
|
createResolver,
|
|
13
|
-
type PluginContext,
|
|
14
15
|
} from '@dxos/app-framework';
|
|
15
16
|
import { Obj } from '@dxos/echo';
|
|
16
|
-
import { createDocAccessor, getRangeFromCursor
|
|
17
|
-
|
|
17
|
+
import { createDocAccessor, getRangeFromCursor } from '@dxos/react-client/echo';
|
|
18
|
+
|
|
19
|
+
import { Markdown, MarkdownAction } from '../types';
|
|
18
20
|
|
|
19
21
|
import { MarkdownCapabilities } from './capabilities';
|
|
20
|
-
import { DocumentType, MarkdownAction } from '../types';
|
|
21
22
|
|
|
22
23
|
export default (context: PluginContext) =>
|
|
23
24
|
contributes(Capabilities.IntentResolver, [
|
|
24
25
|
createResolver({
|
|
25
26
|
intent: MarkdownAction.Create,
|
|
26
27
|
resolve: ({ name, content }) => {
|
|
27
|
-
|
|
28
|
-
name,
|
|
29
|
-
content: Ref.make(Obj.make(DataType.Text, { content: content ?? '' })),
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
return { data: { object: doc } };
|
|
28
|
+
return { data: { object: Markdown.makeDocument({ name, content }) } };
|
|
33
29
|
},
|
|
34
30
|
}),
|
|
35
31
|
createResolver({
|
|
@@ -40,23 +36,22 @@ export default (context: PluginContext) =>
|
|
|
40
36
|
},
|
|
41
37
|
}),
|
|
42
38
|
createResolver({
|
|
43
|
-
intent: CollaborationActions.
|
|
39
|
+
intent: CollaborationActions.AcceptProposal,
|
|
44
40
|
filter: (
|
|
45
41
|
data,
|
|
46
|
-
): data is Omit<Schema.Schema.Type<typeof CollaborationActions.
|
|
47
|
-
|
|
48
|
-
} => Obj.instanceOf(
|
|
49
|
-
resolve: async ({
|
|
50
|
-
const text = await
|
|
42
|
+
): data is Omit<Schema.Schema.Type<typeof CollaborationActions.AcceptProposal.fields.input>, 'subject'> & {
|
|
43
|
+
subject: Markdown.Document;
|
|
44
|
+
} => Obj.instanceOf(Markdown.Document, data.subject),
|
|
45
|
+
resolve: async ({ subject, anchor, proposal }) => {
|
|
46
|
+
const text = await subject.content.load();
|
|
51
47
|
const accessor = createDocAccessor(text, ['content']);
|
|
52
|
-
const { start, end } = pipe(
|
|
53
|
-
Option.fromNullable(at),
|
|
48
|
+
const { start, end } = Option.fromNullable(anchor).pipe(
|
|
54
49
|
Option.flatMap((at) => Option.fromNullable(getRangeFromCursor(accessor, at))),
|
|
50
|
+
// Fallback to the end of the document.
|
|
55
51
|
Option.getOrElse(() => ({ start: text.content.length - 1, end: text.content.length - 1 })),
|
|
56
52
|
);
|
|
57
53
|
accessor.handle.change((doc) => {
|
|
58
|
-
|
|
59
|
-
A.splice(doc, accessor.path.slice(), start, end - start, ref);
|
|
54
|
+
A.splice(doc, accessor.path.slice(), start, end - start, proposal.text);
|
|
60
55
|
});
|
|
61
56
|
},
|
|
62
57
|
}),
|
|
@@ -4,29 +4,31 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capabilities, contributes, createSurface, useCapability } from '@dxos/app-framework';
|
|
8
8
|
import { Obj } from '@dxos/echo';
|
|
9
9
|
import { SettingsStore } from '@dxos/local-storage';
|
|
10
10
|
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
11
11
|
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
12
12
|
import { DataType } from '@dxos/schema';
|
|
13
13
|
|
|
14
|
+
import { MarkdownCard, MarkdownContainer, MarkdownSettings } from '../components';
|
|
15
|
+
import { meta } from '../meta';
|
|
16
|
+
import { Markdown } from '../types';
|
|
17
|
+
import { isEditorModel } from '../util';
|
|
18
|
+
|
|
14
19
|
import { MarkdownCapabilities } from './capabilities';
|
|
15
|
-
import { MarkdownContainer, MarkdownSettings, MarkdownPreview } from '../components';
|
|
16
|
-
import { MARKDOWN_PLUGIN } from '../meta';
|
|
17
|
-
import { DocumentType, isEditorModel, type MarkdownSettingsProps } from '../types';
|
|
18
20
|
|
|
19
21
|
export default () =>
|
|
20
22
|
contributes(Capabilities.ReactSurface, [
|
|
21
23
|
createSurface({
|
|
22
|
-
id: `${
|
|
24
|
+
id: `${meta.id}/surface/document`,
|
|
23
25
|
role: ['article', 'section', 'tabpanel'],
|
|
24
|
-
filter: (data): data is { subject:
|
|
25
|
-
Obj.instanceOf(
|
|
26
|
+
filter: (data): data is { subject: Markdown.Document; variant: undefined } =>
|
|
27
|
+
Obj.instanceOf(Markdown.Document, data.subject) && !data.variant,
|
|
26
28
|
component: ({ data, role }) => {
|
|
27
29
|
const selectionManager = useCapability(AttentionCapabilities.Selection);
|
|
28
30
|
const settingsStore = useCapability(Capabilities.SettingsStore);
|
|
29
|
-
const settings = settingsStore.getStore<
|
|
31
|
+
const settings = settingsStore.getStore<Markdown.Settings>(meta.id)!.value;
|
|
30
32
|
const { state, editorState, getViewMode, setViewMode } = useCapability(MarkdownCapabilities.State);
|
|
31
33
|
const viewMode = getViewMode(fullyQualifiedId(data.subject));
|
|
32
34
|
|
|
@@ -46,14 +48,14 @@ export default () =>
|
|
|
46
48
|
},
|
|
47
49
|
}),
|
|
48
50
|
createSurface({
|
|
49
|
-
id: `${
|
|
51
|
+
id: `${meta.id}/surface/text`,
|
|
50
52
|
role: ['article', 'section', 'tabpanel'],
|
|
51
53
|
filter: (data): data is { id: string; subject: DataType.Text } =>
|
|
52
54
|
typeof data.id === 'string' && Obj.instanceOf(DataType.Text, data.subject),
|
|
53
55
|
component: ({ data, role }) => {
|
|
54
56
|
const selectionManager = useCapability(AttentionCapabilities.Selection);
|
|
55
57
|
const settingsStore = useCapability(Capabilities.SettingsStore);
|
|
56
|
-
const settings = settingsStore.getStore<
|
|
58
|
+
const settings = settingsStore.getStore<Markdown.Settings>(meta.id)!.value;
|
|
57
59
|
const { state, editorState, getViewMode, setViewMode } = useCapability(MarkdownCapabilities.State);
|
|
58
60
|
|
|
59
61
|
return (
|
|
@@ -72,13 +74,13 @@ export default () =>
|
|
|
72
74
|
},
|
|
73
75
|
}),
|
|
74
76
|
createSurface({
|
|
75
|
-
id: `${
|
|
77
|
+
id: `${meta.id}/surface/editor`,
|
|
76
78
|
role: ['article', 'section'],
|
|
77
79
|
filter: (data): data is { subject: { id: string; text: string } } => isEditorModel(data.subject),
|
|
78
80
|
component: ({ data, role }) => {
|
|
79
81
|
const selectionManager = useCapability(AttentionCapabilities.Selection);
|
|
80
82
|
const settingsStore = useCapability(Capabilities.SettingsStore);
|
|
81
|
-
const settings = settingsStore.getStore<
|
|
83
|
+
const settings = settingsStore.getStore<Markdown.Settings>(meta.id)!.value;
|
|
82
84
|
const { state, editorState, getViewMode, setViewMode } = useCapability(MarkdownCapabilities.State);
|
|
83
85
|
|
|
84
86
|
return (
|
|
@@ -97,17 +99,17 @@ export default () =>
|
|
|
97
99
|
},
|
|
98
100
|
}),
|
|
99
101
|
createSurface({
|
|
100
|
-
id: `${
|
|
102
|
+
id: `${meta.id}/surface/plugin-settings`,
|
|
101
103
|
role: 'article',
|
|
102
|
-
filter: (data): data is { subject: SettingsStore<
|
|
103
|
-
data.subject instanceof SettingsStore && data.subject.prefix ===
|
|
104
|
+
filter: (data): data is { subject: SettingsStore<Markdown.Settings> } =>
|
|
105
|
+
data.subject instanceof SettingsStore && data.subject.prefix === meta.id,
|
|
104
106
|
component: ({ data: { subject } }) => <MarkdownSettings settings={subject.value} />,
|
|
105
107
|
}),
|
|
106
108
|
createSurface({
|
|
107
|
-
id: `${
|
|
109
|
+
id: `${meta.id}/surface/preview`,
|
|
108
110
|
role: ['card--popover', 'card--intrinsic', 'card--extrinsic', 'card--transclusion', 'card'],
|
|
109
|
-
filter: (data): data is { subject:
|
|
110
|
-
Obj.instanceOf(
|
|
111
|
-
component: ({ data, role }) => <
|
|
111
|
+
filter: (data): data is { subject: Markdown.Document | DataType.Text } =>
|
|
112
|
+
Obj.instanceOf(Markdown.Document, data.subject) || Obj.instanceOf(DataType.Text, data.subject),
|
|
113
|
+
component: ({ data, role }) => <MarkdownCard {...data} role={role} />,
|
|
112
114
|
}),
|
|
113
115
|
]);
|
|
@@ -6,10 +6,10 @@ import { Capabilities, contributes } from '@dxos/app-framework';
|
|
|
6
6
|
import { live } from '@dxos/live-object';
|
|
7
7
|
|
|
8
8
|
import { meta } from '../meta';
|
|
9
|
-
import {
|
|
9
|
+
import { Markdown } from '../types';
|
|
10
10
|
|
|
11
11
|
export default () => {
|
|
12
|
-
const settings = live<
|
|
12
|
+
const settings = live<Markdown.Settings>({
|
|
13
13
|
defaultViewMode: 'preview',
|
|
14
14
|
toolbar: true,
|
|
15
15
|
numberedHeadings: true,
|
|
@@ -19,7 +19,7 @@ export default () => {
|
|
|
19
19
|
|
|
20
20
|
return contributes(Capabilities.Settings, {
|
|
21
21
|
prefix: meta.id,
|
|
22
|
-
schema:
|
|
22
|
+
schema: Markdown.Settings,
|
|
23
23
|
value: settings,
|
|
24
24
|
});
|
|
25
25
|
};
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Capabilities,
|
|
5
|
+
import { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';
|
|
6
6
|
import { LocalStorageStore } from '@dxos/local-storage';
|
|
7
7
|
import { type EditorViewMode, createEditorStateStore } from '@dxos/react-ui-editor';
|
|
8
8
|
|
|
9
|
+
import { meta } from '../meta';
|
|
10
|
+
import { type Markdown, type MarkdownPluginState } from '../types';
|
|
11
|
+
|
|
9
12
|
import { MarkdownCapabilities } from './capabilities';
|
|
10
|
-
import { MARKDOWN_PLUGIN } from '../meta';
|
|
11
|
-
import { type MarkdownPluginState, type MarkdownSettingsProps } from '../types';
|
|
12
13
|
|
|
13
14
|
export default (context: PluginContext) => {
|
|
14
|
-
const state = new LocalStorageStore<MarkdownPluginState>(
|
|
15
|
+
const state = new LocalStorageStore<MarkdownPluginState>(meta.id, { extensionProviders: [], viewMode: {} });
|
|
15
16
|
state.prop({ key: 'viewMode', type: LocalStorageStore.json<{ [key: string]: EditorViewMode }>() });
|
|
16
17
|
|
|
17
18
|
// TODO(wittjosiah): Fold into state.
|
|
18
|
-
const editorState = createEditorStateStore(`${
|
|
19
|
+
const editorState = createEditorStateStore(`${meta.id}/editor`);
|
|
19
20
|
|
|
20
21
|
const getViewMode = (id: string) => {
|
|
21
|
-
const defaultViewMode = context
|
|
22
|
-
.
|
|
23
|
-
.getStore<MarkdownSettingsProps>(MARKDOWN_PLUGIN)!.value.defaultViewMode;
|
|
22
|
+
const defaultViewMode = context.getCapability(Capabilities.SettingsStore).getStore<Markdown.Settings>(meta.id)!
|
|
23
|
+
.value.defaultViewMode;
|
|
24
24
|
return (id && state.values.viewMode[id]) || defaultViewMode;
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Tool from '@effect/ai/Tool';
|
|
6
|
+
import * as Toolkit from '@effect/ai/Toolkit';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
import * as Schema from 'effect/Schema';
|
|
9
|
+
|
|
10
|
+
import { Capabilities, type Capability, type PluginContext, contributes, createIntent } from '@dxos/app-framework';
|
|
11
|
+
import { invariant } from '@dxos/invariant';
|
|
12
|
+
import { getActiveSpace } from '@dxos/plugin-space';
|
|
13
|
+
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
14
|
+
|
|
15
|
+
import { MarkdownAction } from '../types';
|
|
16
|
+
|
|
17
|
+
// TODO(burdon): Reconcile with functions (currently reuses plugin framework intents).
|
|
18
|
+
class MarkdownToolkit extends Toolkit.make(
|
|
19
|
+
Tool.make('create-document', {
|
|
20
|
+
description: 'Creates a new markdown document.',
|
|
21
|
+
parameters: {
|
|
22
|
+
name: Schema.optional(Schema.String),
|
|
23
|
+
content: Schema.optional(Schema.String),
|
|
24
|
+
},
|
|
25
|
+
// TODO(wittjosiah): Return document.
|
|
26
|
+
success: Schema.Any,
|
|
27
|
+
failure: Schema.Never,
|
|
28
|
+
}),
|
|
29
|
+
) {
|
|
30
|
+
static layer = (context: PluginContext) =>
|
|
31
|
+
MarkdownToolkit.toLayer({
|
|
32
|
+
'create-document': ({ name, content }) => {
|
|
33
|
+
const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
34
|
+
const space = getActiveSpace(context);
|
|
35
|
+
invariant(space, 'No active space');
|
|
36
|
+
|
|
37
|
+
return Effect.gen(function* () {
|
|
38
|
+
const { object } = yield* dispatch(createIntent(MarkdownAction.Create, { name, content }));
|
|
39
|
+
yield* dispatch(createIntent(SpaceAction.AddObject, { object, target: space }));
|
|
40
|
+
return { id: object.id };
|
|
41
|
+
}).pipe(Effect.orDie);
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default (context: PluginContext): Capability<any>[] => [
|
|
47
|
+
contributes(Capabilities.Toolkit, MarkdownToolkit),
|
|
48
|
+
contributes(Capabilities.ToolkitHandler, MarkdownToolkit.layer(context)),
|
|
49
|
+
];
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { IntentPlugin } from '@dxos/app-framework';
|
|
9
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
11
|
+
import { faker } from '@dxos/random';
|
|
12
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
13
|
+
import { CardContainer } from '@dxos/react-ui-stack/testing';
|
|
14
|
+
|
|
15
|
+
import { translations } from '../../translations';
|
|
16
|
+
|
|
17
|
+
import { MarkdownCard } from './MarkdownCard';
|
|
18
|
+
|
|
19
|
+
faker.seed(1234);
|
|
20
|
+
|
|
21
|
+
const meta: Meta<typeof MarkdownCard> = {
|
|
22
|
+
title: 'plugins/plugin-markdown/Card',
|
|
23
|
+
component: MarkdownCard,
|
|
24
|
+
render: ({ role, subject, ...args }) => {
|
|
25
|
+
return (
|
|
26
|
+
<CardContainer icon='ph--text-aa--regular' role={role}>
|
|
27
|
+
<MarkdownCard role={role} subject={subject} {...args} />
|
|
28
|
+
</CardContainer>
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
decorators: [
|
|
32
|
+
withTheme,
|
|
33
|
+
withPluginManager({
|
|
34
|
+
plugins: [IntentPlugin()],
|
|
35
|
+
}),
|
|
36
|
+
],
|
|
37
|
+
parameters: {
|
|
38
|
+
layout: 'centered',
|
|
39
|
+
translations,
|
|
40
|
+
},
|
|
41
|
+
tags: ['cards'],
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default meta;
|
|
45
|
+
|
|
46
|
+
type Story = StoryObj<typeof meta>;
|
|
47
|
+
|
|
48
|
+
export const Popover: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
role: 'card--popover',
|
|
51
|
+
subject: Markdown.makeDocument({
|
|
52
|
+
name: faker.lorem.words(3),
|
|
53
|
+
content: faker.lorem.paragraphs(3),
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const Intrinsic: Story = {
|
|
59
|
+
args: {
|
|
60
|
+
role: 'card--intrinsic',
|
|
61
|
+
subject: Markdown.makeDocument({
|
|
62
|
+
name: faker.lorem.words(3),
|
|
63
|
+
content: faker.lorem.paragraphs(3),
|
|
64
|
+
}),
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const Extrinsic: Story = {
|
|
69
|
+
args: {
|
|
70
|
+
role: 'card--extrinsic',
|
|
71
|
+
subject: Markdown.makeDocument({
|
|
72
|
+
name: faker.lorem.words(3),
|
|
73
|
+
content: faker.lorem.paragraphs(3),
|
|
74
|
+
}),
|
|
75
|
+
},
|
|
76
|
+
};
|
package/src/components/{MarkdownPreview/MarkdownPreview.tsx → MarkdownCard/MarkdownCard.tsx}
RENAMED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Function from 'effect/Function';
|
|
6
6
|
import React, { useCallback } from 'react';
|
|
7
7
|
|
|
8
|
-
import { chain, createIntent,
|
|
8
|
+
import { LayoutAction, chain, createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
9
9
|
import { Obj } from '@dxos/echo';
|
|
10
10
|
import { type PreviewProps } from '@dxos/plugin-preview';
|
|
11
11
|
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
@@ -13,13 +13,13 @@ import { Button, Icon, useTranslation } from '@dxos/react-ui';
|
|
|
13
13
|
import { Card } from '@dxos/react-ui-stack';
|
|
14
14
|
import { DataType } from '@dxos/schema';
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { meta } from '../../meta';
|
|
17
|
+
import { Markdown } from '../../types';
|
|
18
18
|
import { getAbstract, getFallbackName } from '../../util';
|
|
19
19
|
|
|
20
20
|
// TODO(burdon): Factor out.
|
|
21
|
-
const getTitle = (subject:
|
|
22
|
-
if (Obj.instanceOf(
|
|
21
|
+
const getTitle = (subject: Markdown.Document | DataType.Text, fallback: string) => {
|
|
22
|
+
if (Obj.instanceOf(Markdown.Document, subject)) {
|
|
23
23
|
return subject.name ?? subject.fallbackName ?? getFallbackName(subject.content?.target?.content ?? fallback);
|
|
24
24
|
} else if (Obj.instanceOf(DataType.Text, subject)) {
|
|
25
25
|
return getFallbackName(subject.content);
|
|
@@ -27,24 +27,26 @@ const getTitle = (subject: DocumentType | DataType.Text, fallback: string) => {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
// TODO(burdon): Factor out.
|
|
30
|
-
const getSnippet = (subject:
|
|
31
|
-
if (Obj.instanceOf(
|
|
30
|
+
const getSnippet = (subject: Markdown.Document | DataType.Text, fallback: string) => {
|
|
31
|
+
if (Obj.instanceOf(Markdown.Document, subject)) {
|
|
32
32
|
return getAbstract(subject.content?.target?.content ?? fallback);
|
|
33
33
|
} else if (Obj.instanceOf(DataType.Text, subject)) {
|
|
34
34
|
return getAbstract(subject.content);
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
export
|
|
38
|
+
export type MarkdownCardProps = PreviewProps<Markdown.Document | DataType.Text>;
|
|
39
|
+
|
|
40
|
+
export const MarkdownCard = ({ subject, role }: MarkdownCardProps) => {
|
|
39
41
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
40
|
-
const { t } = useTranslation(
|
|
42
|
+
const { t } = useTranslation(meta.id);
|
|
41
43
|
const snippet = getSnippet(subject, t('fallback abstract'));
|
|
42
44
|
|
|
43
45
|
// TODO(wittjosiah): Factor out so this component isn't dependent on the app framework.
|
|
44
46
|
const handleNavigate = useCallback(
|
|
45
47
|
() =>
|
|
46
48
|
dispatch(
|
|
47
|
-
pipe(
|
|
49
|
+
Function.pipe(
|
|
48
50
|
createIntent(LayoutAction.UpdatePopover, {
|
|
49
51
|
part: 'popover',
|
|
50
52
|
subject: null,
|
|
@@ -2,102 +2,108 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useMemo } from 'react';
|
|
9
7
|
|
|
10
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
type Capabilities,
|
|
10
|
+
IntentPlugin,
|
|
11
|
+
LayoutAction,
|
|
12
|
+
SettingsPlugin,
|
|
13
|
+
Surface,
|
|
14
|
+
createIntent,
|
|
15
|
+
useIntentDispatcher,
|
|
16
|
+
} from '@dxos/app-framework';
|
|
11
17
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
-
import {
|
|
13
|
-
import { Obj, Query, Ref, Type } from '@dxos/echo';
|
|
18
|
+
import { Obj, Query } from '@dxos/echo';
|
|
14
19
|
import { AttentionPlugin } from '@dxos/plugin-attention';
|
|
15
20
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
16
21
|
import { GraphPlugin } from '@dxos/plugin-graph';
|
|
17
22
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
18
|
-
import {
|
|
23
|
+
import { SpacePlugin } from '@dxos/plugin-space';
|
|
19
24
|
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
20
25
|
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
21
26
|
import { faker } from '@dxos/random';
|
|
22
27
|
import { useQuery, useSpace } from '@dxos/react-client/echo';
|
|
28
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
29
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
23
30
|
import { defaultTx } from '@dxos/react-ui-theme';
|
|
24
31
|
import { DataType } from '@dxos/schema';
|
|
25
|
-
import {
|
|
26
|
-
import { withLayout } from '@dxos/storybook-utils';
|
|
32
|
+
import { type ValueGenerator, createObjectFactory } from '@dxos/schema/testing';
|
|
27
33
|
|
|
28
34
|
import { MarkdownPlugin } from '../MarkdownPlugin';
|
|
29
35
|
import { translations } from '../translations';
|
|
30
|
-
import {
|
|
36
|
+
import { Markdown } from '../types';
|
|
31
37
|
|
|
32
38
|
faker.seed(1);
|
|
33
39
|
|
|
34
40
|
const generator: ValueGenerator = faker as any;
|
|
35
41
|
|
|
36
42
|
const DefaultStory = () => {
|
|
43
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
37
44
|
const space = useSpace();
|
|
38
|
-
const [doc] = useQuery(space, Query.type(
|
|
45
|
+
const [doc] = useQuery(space, Query.type(Markdown.Document));
|
|
39
46
|
const data = useMemo(() => ({ subject: doc }), [doc]);
|
|
40
47
|
|
|
41
|
-
|
|
48
|
+
useAsyncEffect(async () => {
|
|
49
|
+
if (space) {
|
|
50
|
+
await dispatch(createIntent(LayoutAction.SwitchWorkspace, { part: 'workspace', subject: space.id }));
|
|
51
|
+
}
|
|
52
|
+
}, [space, dispatch]);
|
|
53
|
+
|
|
54
|
+
return <Surface role='article' data={data} limit={1} />;
|
|
42
55
|
};
|
|
43
56
|
|
|
44
|
-
const meta
|
|
57
|
+
const meta = {
|
|
45
58
|
title: 'plugins/plugin-markdown/MarkdownContainer',
|
|
46
59
|
render: DefaultStory,
|
|
47
60
|
decorators: [
|
|
61
|
+
withTheme,
|
|
48
62
|
withPluginManager({
|
|
49
63
|
plugins: [
|
|
50
|
-
AttentionPlugin(),
|
|
51
|
-
ThemePlugin({ tx: defaultTx }),
|
|
52
|
-
StorybookLayoutPlugin(),
|
|
53
64
|
ClientPlugin({
|
|
54
|
-
types: [
|
|
55
|
-
onClientInitialized: async (
|
|
65
|
+
types: [Markdown.Document, DataType.Text, DataType.Person, DataType.Organization],
|
|
66
|
+
onClientInitialized: async ({ client }) => {
|
|
56
67
|
await client.halo.createIdentity();
|
|
57
68
|
await client.spaces.waitUntilReady();
|
|
58
69
|
await client.spaces.default.waitUntilReady();
|
|
59
70
|
const space = client.spaces.default;
|
|
60
|
-
const
|
|
71
|
+
const queue = space.queues.create();
|
|
72
|
+
const alice = Obj.make(DataType.Person, { fullName: 'Alice' });
|
|
73
|
+
const acme = Obj.make(DataType.Organization, { name: 'ACME' });
|
|
74
|
+
await queue.append([alice, acme]);
|
|
75
|
+
const doc = Markdown.makeDocument({
|
|
61
76
|
name: 'Test',
|
|
62
|
-
content:
|
|
77
|
+
content: `# Test\n\n})\n\n})`,
|
|
63
78
|
});
|
|
64
79
|
space.db.add(doc);
|
|
65
80
|
const createObjects = createObjectFactory(space.db, generator);
|
|
66
|
-
await createObjects([{ type:
|
|
81
|
+
await createObjects([{ type: DataType.Organization, count: 10 }]);
|
|
67
82
|
await space.db.flush({ indexes: true });
|
|
68
83
|
},
|
|
69
84
|
}),
|
|
70
|
-
SpacePlugin(),
|
|
71
|
-
|
|
85
|
+
SpacePlugin({}),
|
|
86
|
+
GraphPlugin(),
|
|
72
87
|
IntentPlugin(),
|
|
88
|
+
SettingsPlugin(),
|
|
89
|
+
// UI
|
|
90
|
+
ThemePlugin({ tx: defaultTx }),
|
|
91
|
+
AttentionPlugin(),
|
|
73
92
|
MarkdownPlugin(),
|
|
74
93
|
PreviewPlugin(),
|
|
75
|
-
|
|
76
|
-
],
|
|
77
|
-
capabilities: [
|
|
78
|
-
// NOTE: Editor only queries for object form schemas when linking.
|
|
79
|
-
contributes(SpaceCapabilities.ObjectForm, {
|
|
80
|
-
objectSchema: Testing.Contact,
|
|
81
|
-
getIntent: () => todo(),
|
|
82
|
-
}),
|
|
83
|
-
contributes(Capabilities.Metadata, {
|
|
84
|
-
id: Type.getTypename(Testing.Contact),
|
|
85
|
-
metadata: {
|
|
86
|
-
icon: 'ph--user--regular',
|
|
87
|
-
},
|
|
88
|
-
}),
|
|
94
|
+
StorybookLayoutPlugin({}),
|
|
89
95
|
],
|
|
90
96
|
}),
|
|
91
|
-
withLayout({ fullscreen: true }),
|
|
92
97
|
],
|
|
93
98
|
parameters: {
|
|
94
|
-
|
|
99
|
+
layout: 'fullscreen',
|
|
95
100
|
controls: { disable: true },
|
|
101
|
+
translations,
|
|
96
102
|
},
|
|
97
|
-
}
|
|
103
|
+
} satisfies Meta<typeof Capabilities>;
|
|
98
104
|
|
|
99
105
|
export default meta;
|
|
100
106
|
|
|
101
|
-
type Story =
|
|
107
|
+
type Story = StoryObj<typeof meta>;
|
|
102
108
|
|
|
103
109
|
export const Default: Story = {};
|