@dxos/plugin-mermaid 0.8.4-main.9735255 → 0.8.4-main.abd8ff62ef
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/MermaidPlugin-VEW3LRVO.mjs +179 -0
- package/dist/lib/browser/MermaidPlugin-VEW3LRVO.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -172
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/MermaidPlugin.d.ts +1 -0
- package/dist/types/src/MermaidPlugin.d.ts.map +1 -1
- package/dist/types/src/MermaidPlugin.test.d.ts +2 -0
- package/dist/types/src/MermaidPlugin.test.d.ts.map +1 -0
- package/dist/types/src/extensions/mermaid-extension.d.ts.map +1 -1
- package/dist/types/src/extensions/mermaid.stories.d.ts +2 -2
- package/dist/types/src/extensions/mermaid.stories.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/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -20
- package/src/MermaidPlugin.test.ts +30 -0
- package/src/MermaidPlugin.tsx +5 -2
- package/src/extensions/mermaid-extension.ts +3 -3
- package/src/extensions/mermaid.stories.tsx +6 -6
- package/src/index.ts +6 -1
- package/src/meta.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-mermaid",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.abd8ff62ef",
|
|
4
4
|
"description": "Mermaid markdown plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
"author": "DXOS.org",
|
|
13
13
|
"sideEffects": true,
|
|
14
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#plugin": "./src/MermaidPlugin.tsx",
|
|
17
|
+
"#meta": "./src/meta.ts"
|
|
18
|
+
},
|
|
15
19
|
"exports": {
|
|
16
20
|
".": {
|
|
17
21
|
"source": "./src/index.ts",
|
|
@@ -20,9 +24,6 @@
|
|
|
20
24
|
}
|
|
21
25
|
},
|
|
22
26
|
"types": "dist/types/src/index.d.ts",
|
|
23
|
-
"typesVersions": {
|
|
24
|
-
"*": {}
|
|
25
|
-
},
|
|
26
27
|
"files": [
|
|
27
28
|
"dist",
|
|
28
29
|
"src"
|
|
@@ -32,32 +33,32 @@
|
|
|
32
33
|
"@codemirror/state": "^6.5.2",
|
|
33
34
|
"@codemirror/view": "^6.38.4",
|
|
34
35
|
"mermaid": "^10.9.4",
|
|
35
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/plugin-
|
|
38
|
-
"@dxos/react-ui-editor": "0.8.4-main.
|
|
39
|
-
"@dxos/ui-editor": "0.8.4-main.
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
36
|
+
"@dxos/app-framework": "0.8.4-main.abd8ff62ef",
|
|
37
|
+
"@dxos/plugin-markdown": "0.8.4-main.abd8ff62ef",
|
|
38
|
+
"@dxos/plugin-space": "0.8.4-main.abd8ff62ef",
|
|
39
|
+
"@dxos/react-ui-editor": "0.8.4-main.abd8ff62ef",
|
|
40
|
+
"@dxos/ui-editor": "0.8.4-main.abd8ff62ef",
|
|
41
|
+
"@dxos/util": "0.8.4-main.abd8ff62ef",
|
|
42
|
+
"@dxos/operation": "0.8.4-main.abd8ff62ef"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@types/react": "~19.2.7",
|
|
45
46
|
"@types/react-dom": "~19.2.3",
|
|
46
|
-
"effect": "3.
|
|
47
|
+
"effect": "3.20.0",
|
|
47
48
|
"react": "~19.2.3",
|
|
48
49
|
"react-dom": "~19.2.3",
|
|
49
|
-
"vite": "
|
|
50
|
-
"@dxos/echo": "0.8.4-main.
|
|
51
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
52
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
53
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
50
|
+
"vite": "^8.0.10",
|
|
51
|
+
"@dxos/echo": "0.8.4-main.abd8ff62ef",
|
|
52
|
+
"@dxos/react-ui": "0.8.4-main.abd8ff62ef",
|
|
53
|
+
"@dxos/storybook-utils": "0.8.4-main.abd8ff62ef",
|
|
54
|
+
"@dxos/ui-theme": "0.8.4-main.abd8ff62ef"
|
|
54
55
|
},
|
|
55
56
|
"peerDependencies": {
|
|
56
|
-
"effect": "3.
|
|
57
|
+
"effect": "3.20.0",
|
|
57
58
|
"react": "~19.2.3",
|
|
58
59
|
"react-dom": "~19.2.3",
|
|
59
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
60
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
60
|
+
"@dxos/react-ui": "0.8.4-main.abd8ff62ef",
|
|
61
|
+
"@dxos/ui-theme": "0.8.4-main.abd8ff62ef"
|
|
61
62
|
},
|
|
62
63
|
"publishConfig": {
|
|
63
64
|
"access": "public"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { OperationPlugin, RuntimePlugin } from '@dxos/app-framework';
|
|
8
|
+
import { createTestApp } from '@dxos/app-framework/testing';
|
|
9
|
+
import { MarkdownEvents } from '@dxos/plugin-markdown';
|
|
10
|
+
|
|
11
|
+
import { MermaidPlugin } from '#plugin';
|
|
12
|
+
|
|
13
|
+
import { meta } from './meta';
|
|
14
|
+
|
|
15
|
+
const moduleId = (name: string) => `${meta.id}.module.${name}`;
|
|
16
|
+
|
|
17
|
+
describe('MermaidPlugin', () => {
|
|
18
|
+
test('modules activate on the expected events', async ({ expect }) => {
|
|
19
|
+
// Use createTestApp directly — only RuntimePlugin and OperationPlugin are needed.
|
|
20
|
+
// MermaidPlugin has no surface module so SetupReactSurface firing harmlessly is fine.
|
|
21
|
+
await using harness = await createTestApp({
|
|
22
|
+
plugins: [OperationPlugin(), RuntimePlugin(), MermaidPlugin()],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// The markdown module activates on MarkdownEvents.SetupExtensions,
|
|
26
|
+
// which is fired by MarkdownPlugin before its ReactSurface activates.
|
|
27
|
+
await harness.fire(MarkdownEvents.SetupExtensions);
|
|
28
|
+
expect(harness.manager.getActive()).toContain(moduleId('markdown'));
|
|
29
|
+
});
|
|
30
|
+
});
|
package/src/MermaidPlugin.tsx
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { Capability, Plugin } from '@dxos/app-framework';
|
|
8
|
-
import { MarkdownCapabilities, MarkdownEvents } from '@dxos/plugin-markdown';
|
|
8
|
+
import { MarkdownCapabilities, MarkdownEvents } from '@dxos/plugin-markdown/types';
|
|
9
|
+
|
|
10
|
+
import { meta } from '#meta';
|
|
9
11
|
|
|
10
12
|
import { mermaid } from './extensions';
|
|
11
|
-
import { meta } from './meta';
|
|
12
13
|
|
|
13
14
|
export const MermaidPlugin = Plugin.define(meta).pipe(
|
|
14
15
|
Plugin.addModule({
|
|
@@ -18,3 +19,5 @@ export const MermaidPlugin = Plugin.define(meta).pipe(
|
|
|
18
19
|
}),
|
|
19
20
|
Plugin.make,
|
|
20
21
|
);
|
|
22
|
+
|
|
23
|
+
export default MermaidPlugin;
|
|
@@ -112,18 +112,18 @@ export const mermaid = (_options: MermaidOptions = {}): Extension => {
|
|
|
112
112
|
maring: '4px 0',
|
|
113
113
|
padding: '16px',
|
|
114
114
|
justifyContent: 'center',
|
|
115
|
-
backgroundColor: 'var(--
|
|
115
|
+
backgroundColor: 'var(--color-group-surface)',
|
|
116
116
|
borderRadius: '8px',
|
|
117
117
|
},
|
|
118
118
|
'& .cm-mermaid-label': {
|
|
119
119
|
position: 'absolute',
|
|
120
120
|
right: '16px',
|
|
121
121
|
fontFamily: 'unset',
|
|
122
|
-
color: 'var(--
|
|
122
|
+
color: 'var(--color-subdued)',
|
|
123
123
|
},
|
|
124
124
|
'& .cm-mermaid-error': {
|
|
125
125
|
display: 'inline-block',
|
|
126
|
-
color: 'var(--
|
|
126
|
+
color: 'var(--color-error)',
|
|
127
127
|
},
|
|
128
128
|
'& .cm-mermaid-hidden': {
|
|
129
129
|
display: 'none !important',
|
|
@@ -6,8 +6,8 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { useThemeContext } from '@dxos/react-ui';
|
|
9
|
-
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
10
9
|
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
10
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
11
|
import {
|
|
12
12
|
createBasicExtensions,
|
|
13
13
|
createMarkdownExtensions,
|
|
@@ -19,11 +19,11 @@ import { mermaid } from './mermaid-extension';
|
|
|
19
19
|
|
|
20
20
|
const str = (...lines: string[]) => lines.join('\n');
|
|
21
21
|
|
|
22
|
-
type
|
|
22
|
+
type DefaultStoryProps = {
|
|
23
23
|
text?: string;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
const DefaultStory = ({ text }:
|
|
26
|
+
const DefaultStory = ({ text }: DefaultStoryProps) => {
|
|
27
27
|
const { themeMode } = useThemeContext();
|
|
28
28
|
const { parentRef, focusAttributes } = useTextEditor(
|
|
29
29
|
() => ({
|
|
@@ -39,13 +39,13 @@ const DefaultStory = ({ text }: StoryProps) => {
|
|
|
39
39
|
[themeMode],
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
-
return <div className='
|
|
42
|
+
return <div className='w-[50rem]' ref={parentRef} {...focusAttributes} />;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
const meta = {
|
|
46
|
-
title: 'plugins/plugin-mermaid/extensions',
|
|
46
|
+
title: 'plugins/plugin-mermaid/extensions/mermaid',
|
|
47
47
|
render: DefaultStory,
|
|
48
|
-
decorators: [withTheme, withLayout({ layout: 'column' })],
|
|
48
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
49
49
|
} satisfies Meta<typeof DefaultStory>;
|
|
50
50
|
|
|
51
51
|
export default meta;
|
package/src/index.ts
CHANGED
|
@@ -2,5 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const MermaidPlugin = Plugin.lazy(meta, () => import('./MermaidPlugin'));
|
|
10
|
+
|
|
6
11
|
export * from './meta';
|
package/src/meta.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
export const meta: Plugin.Meta = {
|
|
9
|
-
id: 'dxos.
|
|
9
|
+
id: 'org.dxos.plugin.mermaid',
|
|
10
10
|
name: 'Mermaid',
|
|
11
11
|
description: trim`
|
|
12
12
|
Generate diagrams from simple text-based definitions using Mermaid syntax.
|