@dxos/plugin-mermaid 0.10.0 → 0.11.1

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.
Files changed (34) hide show
  1. package/PLUGIN.mdl +5 -5
  2. package/dist/lib/MermaidPlugin.mjs +21 -0
  3. package/dist/lib/MermaidPlugin.mjs.map +1 -0
  4. package/dist/lib/capabilities.mjs +7 -0
  5. package/dist/lib/capabilities.mjs.map +1 -0
  6. package/dist/lib/chunk-markdown-extension.mjs +158 -0
  7. package/dist/lib/chunk-markdown-extension.mjs.map +1 -0
  8. package/dist/lib/{neutral/chunk-ZBARIEVA.mjs → chunk-meta.mjs} +19 -23
  9. package/dist/lib/chunk-meta.mjs.map +1 -0
  10. package/dist/lib/index.mjs +2 -0
  11. package/dist/lib/meta.mjs +2 -0
  12. package/dist/lib/plugin.mjs +8 -0
  13. package/dist/lib/plugin.mjs.map +1 -0
  14. package/dist/types/src/capabilities/markdown-extension.d.ts +1 -1
  15. package/dist/types/src/extensions/mermaid-extension.d.ts +6 -1
  16. package/dist/types/src/extensions/mermaid-extension.d.ts.map +1 -1
  17. package/dist/types/tsconfig.tsbuildinfo +1 -1
  18. package/dx.config.ts +1 -0
  19. package/package.json +24 -24
  20. package/src/extensions/mermaid-extension.ts +10 -5
  21. package/dist/lib/neutral/MermaidPlugin.mjs +0 -29
  22. package/dist/lib/neutral/MermaidPlugin.mjs.map +0 -7
  23. package/dist/lib/neutral/capabilities/index.mjs +0 -7
  24. package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
  25. package/dist/lib/neutral/chunk-ZBARIEVA.mjs.map +0 -7
  26. package/dist/lib/neutral/index.mjs +0 -7
  27. package/dist/lib/neutral/index.mjs.map +0 -7
  28. package/dist/lib/neutral/markdown-extension-7YWEUNWO.mjs +0 -172
  29. package/dist/lib/neutral/markdown-extension-7YWEUNWO.mjs.map +0 -7
  30. package/dist/lib/neutral/meta.json +0 -1
  31. package/dist/lib/neutral/meta.mjs +0 -7
  32. package/dist/lib/neutral/meta.mjs.map +0 -7
  33. package/dist/lib/neutral/plugin.mjs +0 -11
  34. package/dist/lib/neutral/plugin.mjs.map +0 -7
package/dx.config.ts CHANGED
@@ -31,5 +31,6 @@ export default Config2.make({
31
31
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-mermaid',
32
32
  icon: { key: 'ph--anchor-simple--regular', hue: 'cyan' },
33
33
  spec: 'PLUGIN.mdl',
34
+ tags: ['alpha'],
34
35
  },
35
36
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-mermaid",
3
- "version": "0.10.0",
3
+ "version": "0.11.1",
4
4
  "description": "Mermaid markdown plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -16,30 +16,30 @@
16
16
  "#capabilities": {
17
17
  "source": "./src/capabilities/index.ts",
18
18
  "types": "./dist/types/src/capabilities/index.d.ts",
19
- "default": "./dist/lib/neutral/capabilities/index.mjs"
19
+ "default": "./dist/lib/capabilities.mjs"
20
20
  },
21
21
  "#meta": {
22
22
  "source": "./src/meta.ts",
23
23
  "types": "./dist/types/src/meta.d.ts",
24
- "default": "./dist/lib/neutral/meta.mjs"
24
+ "default": "./dist/lib/meta.mjs"
25
25
  },
26
26
  "#plugin": {
27
27
  "source": "./src/MermaidPlugin.tsx",
28
28
  "types": "./dist/types/src/MermaidPlugin.d.ts",
29
- "default": "./dist/lib/neutral/MermaidPlugin.mjs"
29
+ "default": "./dist/lib/MermaidPlugin.mjs"
30
30
  }
31
31
  },
32
32
  "exports": {
33
33
  ".": {
34
34
  "source": "./src/index.ts",
35
35
  "types": "./dist/types/src/index.d.ts",
36
- "default": "./dist/lib/neutral/index.mjs"
36
+ "import": "./dist/lib/index.mjs"
37
37
  },
38
38
  "./assets/PLUGIN.mdl": "./PLUGIN.mdl",
39
39
  "./plugin": {
40
40
  "source": "./src/plugin.ts",
41
41
  "types": "./dist/types/src/plugin.d.ts",
42
- "default": "./dist/lib/neutral/plugin.mjs"
42
+ "import": "./dist/lib/plugin.mjs"
43
43
  }
44
44
  },
45
45
  "types": "dist/types/src/index.d.ts",
@@ -50,18 +50,18 @@
50
50
  "PLUGIN.mdl"
51
51
  ],
52
52
  "dependencies": {
53
- "@codemirror/language": "^6.12.3",
54
- "@codemirror/state": "^6.6.0",
55
- "@codemirror/view": "^6.43.0",
53
+ "@codemirror/language": "^6.12.4",
54
+ "@codemirror/state": "^6.7.1",
55
+ "@codemirror/view": "^6.43.6",
56
56
  "mermaid": "^10.9.4",
57
- "@dxos/app-framework": "0.10.0",
58
- "@dxos/keys": "0.10.0",
59
- "@dxos/operation": "0.10.0",
60
- "@dxos/plugin-markdown": "0.10.0",
61
- "@dxos/react-ui-editor": "0.10.0",
62
- "@dxos/ui-editor": "0.10.0",
63
- "@dxos/app-toolkit": "0.10.0",
64
- "@dxos/util": "0.10.0"
57
+ "@dxos/app-framework": "0.11.1",
58
+ "@dxos/app-toolkit": "0.11.1",
59
+ "@dxos/keys": "0.11.1",
60
+ "@dxos/operation": "0.11.1",
61
+ "@dxos/plugin-markdown": "0.11.1",
62
+ "@dxos/react-ui-editor": "0.11.1",
63
+ "@dxos/ui-editor": "0.11.1",
64
+ "@dxos/util": "0.11.1"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@types/react": "~19.2.17",
@@ -69,18 +69,18 @@
69
69
  "effect": "3.21.4",
70
70
  "react": "~19.2.7",
71
71
  "react-dom": "~19.2.7",
72
- "vite": "^8.0.16",
73
- "@dxos/react-ui": "0.10.0",
74
- "@dxos/storybook-utils": "0.10.0",
75
- "@dxos/ui-theme": "0.10.0",
76
- "@dxos/echo": "0.10.0"
72
+ "vite": "^8.1.4",
73
+ "@dxos/echo": "0.11.1",
74
+ "@dxos/react-ui": "0.11.1",
75
+ "@dxos/storybook-utils": "0.11.1",
76
+ "@dxos/ui-theme": "0.11.1"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "effect": "3.21.4",
80
80
  "react": "~19.2.7",
81
81
  "react-dom": "~19.2.7",
82
- "@dxos/ui-theme": "0.10.0",
83
- "@dxos/react-ui": "0.10.0"
82
+ "@dxos/react-ui": "^0.11.1",
83
+ "@dxos/ui-theme": "^0.11.1"
84
84
  },
85
85
  "publishConfig": {
86
86
  "access": "public"
@@ -5,14 +5,19 @@
5
5
  import { syntaxTree } from '@codemirror/language';
6
6
  import { type Extension } from '@codemirror/state';
7
7
  import { Decoration, type DecorationSet, EditorView, ViewPlugin, type ViewUpdate, WidgetType } from '@codemirror/view';
8
- import _mermaid from 'mermaid';
8
+ import Mermaid from 'mermaid';
9
9
 
10
10
  export type MermaidOptions = {};
11
11
 
12
12
  /**
13
13
  * Extension to create mermaid diagrams.
14
+ *
15
+ * The fenced source is highlighted while the cursor is inside the block (where this extension
16
+ * suppresses the widget). That highlighting comes from `mermaidLanguageDescription`, registered in
17
+ * `@dxos/ui-editor`'s markdown bundle rather than here: `codeLanguages` is read once when the
18
+ * markdown parser is built, so an extension contributed afterwards cannot add a fenced-code language.
14
19
  */
15
- export const mermaid = (_options: MermaidOptions = {}): Extension => {
20
+ export const mermaid = (_: MermaidOptions = {}): Extension => {
16
21
  return [
17
22
  ViewPlugin.fromClass(
18
23
  class {
@@ -159,7 +164,7 @@ class MermaidWidget extends WidgetType {
159
164
 
160
165
  setTimeout(async () => {
161
166
  // https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts
162
- _mermaid.initialize({
167
+ Mermaid.initialize({
163
168
  darkMode: view.state.facet(EditorView.darkTheme),
164
169
  theme: 'neutral',
165
170
  // TODO(burdon): Styles.
@@ -200,9 +205,9 @@ class MermaidWidget extends WidgetType {
200
205
  async render(_container: Element): Promise<string | undefined> {
201
206
  try {
202
207
  // https://github.com/mermaid-js/mermaid
203
- const valid = await _mermaid.parse(this._source);
208
+ const valid = await Mermaid.parse(this._source);
204
209
  if (valid) {
205
- const result = await _mermaid.render(this._id, this._source);
210
+ const result = await Mermaid.render(this._id, this._source);
206
211
  this._error = undefined;
207
212
  this._svg = result.svg;
208
213
  return result.svg;
@@ -1,29 +0,0 @@
1
- // src/MermaidPlugin.tsx
2
- import { Plugin } from "@dxos/app-framework";
3
- import { AppPlugin } from "@dxos/app-toolkit";
4
- import { MarkdownEvents } from "@dxos/plugin-markdown";
5
- import { MarkdownExtension } from "#capabilities";
6
- import { meta } from "#meta";
7
-
8
- // raw-loader:/__w/dxos/dxos/packages/plugins/plugin-mermaid/PLUGIN.mdl
9
- var PLUGIN_default = "---\nid: org.dxos.plugin.mermaid\nname: MermaidPlugin\nversion: 0.1.0\n---\n\nA CodeMirror extension plugin for DXOS Composer that renders Mermaid diagram\ndefinitions as live SVG previews inside the markdown editor.\n\n## Extensions\n\nThe following extension dialects are used in this document.\nEach extension is defined in the Appendix or resolved via its URI.\n\n| Term | URI |\n|-------------|-------------------------------|\n| `type` | `org.dxos.mdl.type@1.0` |\n| `feat` | `org.dxos.mdl.feat@1.0` |\n| `test` | `org.dxos.mdl.test@1.0` |\n| `component` | `org.dxos.mdl.component@1.0` |\n| `op` | `org.dxos.mdl.op@1.0` |\n\n## Types\n\n```mdl\ntype DiagramKind\n literals: flowchart | sequenceDiagram | classDiagram | stateDiagram | erDiagram | gantt | pie | gitGraph | mindmap | timeline\n```\n\n```mdl\ntype DiagramTheme\n literals: default | neutral | dark | forest | base\n```\n\n```mdl\ntype RenderResult\n fields:\n svg: string # rendered SVG markup\n id: string # unique widget id used by the Mermaid API\n```\n\n```mdl\ntype RenderError\n fields:\n message: string # human-readable parse or render error text\n source: string # the Mermaid source that caused the error\n```\n\n## Components\n\n```mdl\ncomponent MermaidWidget\n desc: |\n An inline CodeMirror widget that replaces a ```mermaid fenced code block\n with its rendered SVG diagram. The source code block is hidden while the\n cursor is outside it; moving the cursor inside restores the raw text for\n editing.\n props:\n id: string # unique widget id (mermaid-<offset>)\n source: string # raw Mermaid diagram source\n label?: string # first token of source used as a diagram-type badge\n darkMode: boolean # mirrors the editor dark-theme facet\n state:\n svg?: string # last successfully rendered SVG\n error?: string # last render error message; shown in place of diagram\n layout: |\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 [rendered SVG diagram] \u2502\n \u2502 [label] \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n (on error)\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 error text \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n## Operations\n\n```mdl\nop renderDiagram\n desc: Parses a Mermaid source string and renders it to SVG via the Mermaid JS API.\n input:\n id: string # unique element id required by the Mermaid render API\n source: string # raw Mermaid diagram definition\n darkMode?: boolean # sets darkMode / theme on the Mermaid config\n output: RenderResult\n errors:\n ParseError: source does not conform to Mermaid syntax\n RenderError: SVG generation failed after successful parse\n```\n\n## Features\n\n```mdl\nfeat F-1: Diagram Rendering\n\n req F-1.1:\n when: a fenced code block with language tag `mermaid` is present in the document\n then: the block is replaced by a rendered SVG diagram widget\n\n req F-1.2:\n when: the cursor moves inside the fenced code block\n then: raw source text is revealed for editing and the widget is hidden\n\n req F-1.3:\n when: the cursor moves outside the fenced code block\n then: the widget is restored and the raw text is hidden\n\n req F-1.4:\n when: the editor is in read-only mode\n then: widgets are always shown regardless of cursor position\n```\n\n```mdl\nfeat F-2: Error Handling\n\n req F-2.1:\n when: Mermaid fails to parse the source\n then: an inline error message is shown in place of the diagram\n\n req F-2.2:\n when: a previously failing source is corrected\n then: the widget re-renders and displays the valid diagram\n```\n\n```mdl\nfeat F-3: Theme Integration\n\n req F-3.1:\n when: the editor's dark-theme facet is true\n then: the Mermaid diagram is initialized with darkMode enabled\n\n req F-3.2: The rendered widget uses the editor's group-surface background token.\n```\n\n```mdl\nfeat F-4: Markdown Editor Integration\n\n req F-4.1:\n when: the MermaidPlugin is loaded\n then: it registers the mermaid CodeMirror extension via MarkdownCapabilities.ExtensionProvider\n\n req F-4.2: The plugin activates on MarkdownEvents.SetupExtensions.\n```\n\n## Acceptance\n\n```mdl\ntest T-1: Valid flowchart renders\n given: a document containing a ```mermaid fenced block with a valid flowchart definition\n then:\n - the raw code block lines are hidden\n - an SVG widget is injected immediately after the block\n - no error text is visible\n```\n\n```mdl\ntest T-2: Cursor-in/out toggle\n given: a rendered Mermaid widget is visible\n when: the cursor moves inside the fenced code block\n then:\n - the cm-mermaid-hidden class is removed from the block lines\n - the widget is no longer rendered in the viewport\n\n when: the cursor moves back outside the block\n then:\n - block lines are hidden again\n - widget is rendered again\n```\n\n```mdl\ntest T-3: Invalid syntax shows error\n given: a document containing a ```mermaid block with invalid syntax\n then:\n - no SVG is rendered\n - an inline error message is shown with class cm-mermaid-error\n```\n\n```mdl\ntest T-4: Read-only always shows widget\n given: the editor is in read-only mode\n when: any cursor position\n then: widgets are rendered and raw source lines remain hidden\n```\n\n```mdl\ntest T-5: Plugin activates on markdown event\n given: MermaidPlugin and ProcessManagerPlugin are loaded\n when: MarkdownEvents.SetupExtensions fires\n then: the markdown module is in the active module list\n```\n\n---\n\n## Appendix: Extension Definitions\n\nExtension block types used in this document are defined below using\nthe core `ext` primitive \u2014 the only construct the base language provides.\n\n```mdl\next type\n uri: org.dxos.mdl.type@1.0\n desc: A named data structure with typed fields and optional literals.\n fields:\n desc?: Prose\n fields?: FieldMap # name[?]: TypeExpr (# inline comment)\n literals?: UnionList # a | b | c\n extends?: TypeRef[]\n```\n\n```mdl\next feat\n uri: org.dxos.mdl.feat@1.0\n desc: A named feature grouping one or more requirements.\n fields:\n desc?: Prose\n req: RequirementList\n nesting: self\n```\n\n```mdl\next test\n uri: org.dxos.mdl.test@1.0\n desc: An acceptance scenario expressed as given / when / then steps.\n fields:\n given?: Step | Step[]\n when?: Step | Step[]\n then: Step | Step[]\n tags?: TagList\n```\n\n```mdl\next component\n uri: org.dxos.mdl.component@1.0\n desc: A UI component with props, internal state, slots, actions, and events.\n fields:\n desc?: Prose\n props?: FieldMap\n state?: FieldMap\n slots?: FieldMap\n actions?: ActionMap\n emits?: EventMap\n layout?: CodeBlock\n```\n\n```mdl\next op\n uri: org.dxos.mdl.op@1.0\n desc: |\n A named operation with typed inputs, outputs, and declared errors.\n Pure ops have no effects or requires. Effectful ops declare both.\n fields:\n desc?: Prose\n input?: FieldMap\n output?: TypeExpr\n errors?: ErrorMap\n effects?: EffectList\n requires?: ServiceList\n note?: Prose\n```\n";
10
-
11
- // src/MermaidPlugin.tsx
12
- var MermaidPlugin = Plugin.define(meta).pipe(Plugin.addModule({
13
- id: "markdown",
14
- activatesOn: MarkdownEvents.SetupExtensions,
15
- activate: MarkdownExtension
16
- }), AppPlugin.addPluginAssetModule({
17
- asset: {
18
- pluginId: meta.profile.key,
19
- path: "PLUGIN.mdl",
20
- content: PLUGIN_default,
21
- mimeType: "application/x-mdl"
22
- }
23
- }), Plugin.make);
24
- var MermaidPlugin_default = MermaidPlugin;
25
- export {
26
- MermaidPlugin,
27
- MermaidPlugin_default as default
28
- };
29
- //# sourceMappingURL=MermaidPlugin.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/MermaidPlugin.tsx", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-mermaid/PLUGIN.mdl"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { MarkdownEvents } from '@dxos/plugin-markdown';\n\nimport { MarkdownExtension } from '#capabilities';\nimport { meta } from '#meta';\n\n// eslint-disable-next-line import/no-relative-packages\nimport pluginSpec from '../PLUGIN.mdl?raw';\n\nexport const MermaidPlugin = Plugin.define(meta).pipe(\n Plugin.addModule({\n id: 'markdown',\n activatesOn: MarkdownEvents.SetupExtensions,\n activate: MarkdownExtension,\n }),\n AppPlugin.addPluginAssetModule({\n asset: { pluginId: meta.profile.key, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },\n }),\n Plugin.make,\n);\n\nexport default MermaidPlugin;\n", "---\nid: org.dxos.plugin.mermaid\nname: MermaidPlugin\nversion: 0.1.0\n---\n\nA CodeMirror extension plugin for DXOS Composer that renders Mermaid diagram\ndefinitions as live SVG previews inside the markdown editor.\n\n## Extensions\n\nThe following extension dialects are used in this document.\nEach extension is defined in the Appendix or resolved via its URI.\n\n| Term | URI |\n|-------------|-------------------------------|\n| `type` | `org.dxos.mdl.type@1.0` |\n| `feat` | `org.dxos.mdl.feat@1.0` |\n| `test` | `org.dxos.mdl.test@1.0` |\n| `component` | `org.dxos.mdl.component@1.0` |\n| `op` | `org.dxos.mdl.op@1.0` |\n\n## Types\n\n```mdl\ntype DiagramKind\n literals: flowchart | sequenceDiagram | classDiagram | stateDiagram | erDiagram | gantt | pie | gitGraph | mindmap | timeline\n```\n\n```mdl\ntype DiagramTheme\n literals: default | neutral | dark | forest | base\n```\n\n```mdl\ntype RenderResult\n fields:\n svg: string # rendered SVG markup\n id: string # unique widget id used by the Mermaid API\n```\n\n```mdl\ntype RenderError\n fields:\n message: string # human-readable parse or render error text\n source: string # the Mermaid source that caused the error\n```\n\n## Components\n\n```mdl\ncomponent MermaidWidget\n desc: |\n An inline CodeMirror widget that replaces a ```mermaid fenced code block\n with its rendered SVG diagram. The source code block is hidden while the\n cursor is outside it; moving the cursor inside restores the raw text for\n editing.\n props:\n id: string # unique widget id (mermaid-<offset>)\n source: string # raw Mermaid diagram source\n label?: string # first token of source used as a diagram-type badge\n darkMode: boolean # mirrors the editor dark-theme facet\n state:\n svg?: string # last successfully rendered SVG\n error?: string # last render error message; shown in place of diagram\n layout: |\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 [rendered SVG diagram] \u2502\n \u2502 [label] \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n (on error)\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 error text \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n## Operations\n\n```mdl\nop renderDiagram\n desc: Parses a Mermaid source string and renders it to SVG via the Mermaid JS API.\n input:\n id: string # unique element id required by the Mermaid render API\n source: string # raw Mermaid diagram definition\n darkMode?: boolean # sets darkMode / theme on the Mermaid config\n output: RenderResult\n errors:\n ParseError: source does not conform to Mermaid syntax\n RenderError: SVG generation failed after successful parse\n```\n\n## Features\n\n```mdl\nfeat F-1: Diagram Rendering\n\n req F-1.1:\n when: a fenced code block with language tag `mermaid` is present in the document\n then: the block is replaced by a rendered SVG diagram widget\n\n req F-1.2:\n when: the cursor moves inside the fenced code block\n then: raw source text is revealed for editing and the widget is hidden\n\n req F-1.3:\n when: the cursor moves outside the fenced code block\n then: the widget is restored and the raw text is hidden\n\n req F-1.4:\n when: the editor is in read-only mode\n then: widgets are always shown regardless of cursor position\n```\n\n```mdl\nfeat F-2: Error Handling\n\n req F-2.1:\n when: Mermaid fails to parse the source\n then: an inline error message is shown in place of the diagram\n\n req F-2.2:\n when: a previously failing source is corrected\n then: the widget re-renders and displays the valid diagram\n```\n\n```mdl\nfeat F-3: Theme Integration\n\n req F-3.1:\n when: the editor's dark-theme facet is true\n then: the Mermaid diagram is initialized with darkMode enabled\n\n req F-3.2: The rendered widget uses the editor's group-surface background token.\n```\n\n```mdl\nfeat F-4: Markdown Editor Integration\n\n req F-4.1:\n when: the MermaidPlugin is loaded\n then: it registers the mermaid CodeMirror extension via MarkdownCapabilities.ExtensionProvider\n\n req F-4.2: The plugin activates on MarkdownEvents.SetupExtensions.\n```\n\n## Acceptance\n\n```mdl\ntest T-1: Valid flowchart renders\n given: a document containing a ```mermaid fenced block with a valid flowchart definition\n then:\n - the raw code block lines are hidden\n - an SVG widget is injected immediately after the block\n - no error text is visible\n```\n\n```mdl\ntest T-2: Cursor-in/out toggle\n given: a rendered Mermaid widget is visible\n when: the cursor moves inside the fenced code block\n then:\n - the cm-mermaid-hidden class is removed from the block lines\n - the widget is no longer rendered in the viewport\n\n when: the cursor moves back outside the block\n then:\n - block lines are hidden again\n - widget is rendered again\n```\n\n```mdl\ntest T-3: Invalid syntax shows error\n given: a document containing a ```mermaid block with invalid syntax\n then:\n - no SVG is rendered\n - an inline error message is shown with class cm-mermaid-error\n```\n\n```mdl\ntest T-4: Read-only always shows widget\n given: the editor is in read-only mode\n when: any cursor position\n then: widgets are rendered and raw source lines remain hidden\n```\n\n```mdl\ntest T-5: Plugin activates on markdown event\n given: MermaidPlugin and ProcessManagerPlugin are loaded\n when: MarkdownEvents.SetupExtensions fires\n then: the markdown module is in the active module list\n```\n\n---\n\n## Appendix: Extension Definitions\n\nExtension block types used in this document are defined below using\nthe core `ext` primitive \u2014 the only construct the base language provides.\n\n```mdl\next type\n uri: org.dxos.mdl.type@1.0\n desc: A named data structure with typed fields and optional literals.\n fields:\n desc?: Prose\n fields?: FieldMap # name[?]: TypeExpr (# inline comment)\n literals?: UnionList # a | b | c\n extends?: TypeRef[]\n```\n\n```mdl\next feat\n uri: org.dxos.mdl.feat@1.0\n desc: A named feature grouping one or more requirements.\n fields:\n desc?: Prose\n req: RequirementList\n nesting: self\n```\n\n```mdl\next test\n uri: org.dxos.mdl.test@1.0\n desc: An acceptance scenario expressed as given / when / then steps.\n fields:\n given?: Step | Step[]\n when?: Step | Step[]\n then: Step | Step[]\n tags?: TagList\n```\n\n```mdl\next component\n uri: org.dxos.mdl.component@1.0\n desc: A UI component with props, internal state, slots, actions, and events.\n fields:\n desc?: Prose\n props?: FieldMap\n state?: FieldMap\n slots?: FieldMap\n actions?: ActionMap\n emits?: EventMap\n layout?: CodeBlock\n```\n\n```mdl\next op\n uri: org.dxos.mdl.op@1.0\n desc: |\n A named operation with typed inputs, outputs, and declared errors.\n Pure ops have no effects or requires. Effectful ops declare both.\n fields:\n desc?: Prose\n input?: FieldMap\n output?: TypeExpr\n errors?: ErrorMap\n effects?: EffectList\n requires?: ServiceList\n note?: Prose\n```\n"],
5
- "mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAC1B,SAASC,sBAAsB;AAE/B,SAASC,yBAAyB;AAClC,SAASC,YAAY;;;ACTrB;;;ADcO,IAAMC,gBAAgBC,OAAOC,OAAOC,IAAAA,EAAMC,KAC/CH,OAAOI,UAAU;EACfC,IAAI;EACJC,aAAaC,eAAeC;EAC5BC,UAAUC;AACZ,CAAA,GACAC,UAAUC,qBAAqB;EAC7BC,OAAO;IAAEC,UAAUZ,KAAKa,QAAQC;IAAKC,MAAM;IAAcC,SAASC;IAAYC,UAAU;EAAoB;AAC9G,CAAA,GACApB,OAAOqB,IAAI;AAGb,IAAA,wBAAetB;",
6
- "names": ["Plugin", "AppPlugin", "MarkdownEvents", "MarkdownExtension", "meta", "MermaidPlugin", "Plugin", "define", "meta", "pipe", "addModule", "id", "activatesOn", "MarkdownEvents", "SetupExtensions", "activate", "MarkdownExtension", "AppPlugin", "addPluginAssetModule", "asset", "pluginId", "profile", "key", "path", "content", "pluginSpec", "mimeType", "make"]
7
- }
@@ -1,7 +0,0 @@
1
- // src/capabilities/index.ts
2
- import { Capability } from "@dxos/app-framework";
3
- var MarkdownExtension = Capability.lazy("MarkdownExtension", () => import("../markdown-extension-7YWEUNWO.mjs"));
4
- export {
5
- MarkdownExtension
6
- };
7
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/capabilities/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const MarkdownExtension = Capability.lazy('MarkdownExtension', () => import('./markdown-extension'));\n"],
5
- "mappings": ";AAIA,SAASA,kBAAkB;AAEpB,IAAMC,oBAAoBD,WAAWE,KAAK,qBAAqB,MAAM,OAAO,oCAAA,CAAA;",
6
- "names": ["Capability", "MarkdownExtension", "lazy"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts", "../../../dx.config.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport config from '../dx.config';\n\nexport const meta = Plugin.getMetaFromConfig(config);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Config2 } from '@dxos/app-framework/config';\nimport { trim } from '@dxos/util';\n\nexport default Config2.make({\n plugin: {\n key: 'org.dxos.plugin.mermaid',\n name: 'Mermaid',\n author: 'DXOS',\n description: trim`\n Generate diagrams from simple text-based definitions using Mermaid syntax.\n Create flowcharts, sequence diagrams, class diagrams, state diagrams, entity-relationship\n diagrams, Gantt charts, pie charts, Git graphs, mindmaps, and timelines — all from\n plain-text source embedded directly in your documents.\n\n The plugin integrates with the markdown editor as a CodeMirror extension.\n Any fenced code block tagged with the \\`mermaid\\` language identifier is automatically\n detected and replaced with a live SVG preview rendered by the Mermaid JS library.\n The raw source is revealed for editing whenever the cursor moves inside the block,\n then the rendered diagram is restored when the cursor moves away, providing a seamless\n live-preview experience without leaving the editor.\n\n Diagram rendering adapts to the editor's current color scheme: dark-mode documents\n use Mermaid's dark theme while light-mode documents use the neutral theme.\n Parse and render errors are shown inline in place of the diagram so that\n invalid syntax is immediately visible without disrupting the rest of the document.\n `,\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-mermaid',\n icon: { key: 'ph--anchor-simple--regular', hue: 'cyan' },\n spec: 'PLUGIN.mdl',\n },\n});\n"],
5
- "mappings": ";AAIA,SAASA,cAAc;;;ACAvB,SAASC,eAAe;AACxB,SAASC,YAAY;AAErB,IAAA,oBAAeD,QAAQE,KAAK;EAC1BC,QAAQ;IACNC,KAAK;IACLC,MAAM;IACNC,QAAQ;IACRC,aAAaN;;;;;;;;;;;;;;;;;;IAkBbO,QAAQ;IACRC,MAAM;MAAEL,KAAK;MAA8BM,KAAK;IAAO;IACvDC,MAAM;EACR;AACF,CAAA;;;AD1BO,IAAMC,OAAOC,OAAOC,kBAAkBC,iBAAAA;",
6
- "names": ["Plugin", "Config2", "trim", "make", "plugin", "key", "name", "author", "description", "source", "icon", "hue", "spec", "meta", "Plugin", "getMetaFromConfig", "config"]
7
- }
@@ -1,7 +0,0 @@
1
- import {
2
- meta
3
- } from "./chunk-ZBARIEVA.mjs";
4
- export {
5
- meta
6
- };
7
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,172 +0,0 @@
1
- // src/capabilities/markdown-extension.ts
2
- import * as Effect from "effect/Effect";
3
- import { Capability } from "@dxos/app-framework";
4
- import { MarkdownCapabilities } from "@dxos/plugin-markdown/types";
5
-
6
- // src/extensions/mermaid-extension.ts
7
- import { syntaxTree } from "@codemirror/language";
8
- import { Decoration, EditorView, ViewPlugin, WidgetType } from "@codemirror/view";
9
- import _mermaid from "mermaid";
10
- var mermaid = (_options = {}) => {
11
- return [
12
- ViewPlugin.fromClass(class {
13
- decorations;
14
- constructor(view) {
15
- this.decorations = this.buildDecorations(view);
16
- }
17
- update(update) {
18
- if (update.docChanged || update.viewportChanged || update.selectionSet || update.focusChanged) {
19
- this.decorations = this.buildDecorations(update.view);
20
- }
21
- }
22
- buildDecorations(view) {
23
- const decorations = [];
24
- syntaxTree(view.state).iterate({
25
- enter: (node) => {
26
- if (node.name === "FencedCode") {
27
- const cursor = view.state.selection.main.head;
28
- const showWidget = view.state.readOnly || cursor < node.from - 1 || cursor > node.to + 1;
29
- if (showWidget) {
30
- const info = node.node.getChild("CodeInfo");
31
- if (info) {
32
- const type = view.state.sliceDoc(info.from, info.to);
33
- const text = node.node.getChild("CodeText");
34
- if (type === "mermaid" && text) {
35
- const content = view.state.sliceDoc(text.from, text.to).trim();
36
- const label = content.split(" ")[0];
37
- const widget = new MermaidWidget(`mermaid-${node.from}`, content, label);
38
- const endLine = view.state.doc.lineAt(node.to);
39
- const nextLinePos = endLine.to + 1;
40
- if (nextLinePos <= view.state.doc.length) {
41
- decorations.push({
42
- from: nextLinePos,
43
- to: nextLinePos,
44
- decoration: Decoration.widget({
45
- widget
46
- })
47
- });
48
- } else {
49
- decorations.push({
50
- from: endLine.to,
51
- to: endLine.to,
52
- decoration: Decoration.widget({
53
- widget,
54
- side: 1
55
- })
56
- });
57
- }
58
- const startLine = view.state.doc.lineAt(node.from);
59
- for (let lineNum = startLine.number; lineNum <= endLine.number; lineNum++) {
60
- const line = view.state.doc.line(lineNum);
61
- decorations.push({
62
- from: line.from,
63
- to: line.from,
64
- decoration: Decoration.line({
65
- class: "cm-mermaid-hidden"
66
- })
67
- });
68
- }
69
- }
70
- }
71
- }
72
- }
73
- }
74
- });
75
- return Decoration.set(decorations.sort((a, b) => a.from - b.from || a.to - b.to).map((d) => d.decoration.range(d.from, d.to)));
76
- }
77
- }, {
78
- decorations: (v) => v.decorations
79
- }),
80
- EditorView.theme({
81
- "& .cm-mermaid": {
82
- position: "relative",
83
- display: "inline-flex",
84
- width: "100%",
85
- maring: "4px 0",
86
- padding: "16px",
87
- justifyContent: "center",
88
- backgroundColor: "var(--color-group-surface)",
89
- borderRadius: "8px"
90
- },
91
- "& .cm-mermaid-label": {
92
- position: "absolute",
93
- right: "16px",
94
- fontFamily: "unset",
95
- color: "var(--color-subdued)"
96
- },
97
- "& .cm-mermaid-error": {
98
- display: "inline-block",
99
- color: "var(--color-error)"
100
- },
101
- "& .cm-mermaid-hidden": {
102
- display: "none !important"
103
- }
104
- })
105
- ];
106
- };
107
- var MermaidWidget = class extends WidgetType {
108
- _id;
109
- _source;
110
- _label;
111
- _svg;
112
- _error;
113
- // TODO(burdon): Mermaid API requires unique id.
114
- constructor(_id, _source, _label) {
115
- super(), this._id = _id, this._source = _source, this._label = _label;
116
- }
117
- eq(other) {
118
- return this._source === other._source;
119
- }
120
- ignoreEvent(ev) {
121
- return !/^mouse/.test(ev.type);
122
- }
123
- toDOM(view) {
124
- const div = document.createElement("div");
125
- div.className = "cm-mermaid";
126
- setTimeout(async () => {
127
- _mermaid.initialize({
128
- darkMode: view.state.facet(EditorView.darkTheme),
129
- theme: "neutral"
130
- });
131
- const svg = await this.render(div);
132
- if (this._error) {
133
- div.className = "cm-mermaid-error";
134
- div.innerText = this._error;
135
- } else {
136
- div.className = "cm-mermaid";
137
- div.innerHTML = svg;
138
- if (this._label) {
139
- const label = document.createElement("span");
140
- label.innerText = this._label;
141
- label.className = "cm-mermaid-label";
142
- div.appendChild(label);
143
- view.requestMeasure();
144
- }
145
- }
146
- });
147
- return div;
148
- }
149
- async render(_container) {
150
- try {
151
- const valid = await _mermaid.parse(this._source);
152
- if (valid) {
153
- const result = await _mermaid.render(this._id, this._source);
154
- this._error = void 0;
155
- this._svg = result.svg;
156
- return result.svg;
157
- }
158
- } catch (err) {
159
- this._error = String(err);
160
- this._svg = void 0;
161
- }
162
- }
163
- };
164
-
165
- // src/capabilities/markdown-extension.ts
166
- var markdown_extension_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(MarkdownCapabilities.ExtensionProvider, [
167
- mermaid
168
- ])));
169
- export {
170
- markdown_extension_default as default
171
- };
172
- //# sourceMappingURL=markdown-extension-7YWEUNWO.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/markdown-extension.ts", "../../../src/extensions/mermaid-extension.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { MarkdownCapabilities } from '@dxos/plugin-markdown/types';\n\nimport { mermaid } from '../extensions';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(Capability.contributes(MarkdownCapabilities.ExtensionProvider, [mermaid])),\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { syntaxTree } from '@codemirror/language';\nimport { type Extension } from '@codemirror/state';\nimport { Decoration, type DecorationSet, EditorView, ViewPlugin, type ViewUpdate, WidgetType } from '@codemirror/view';\nimport _mermaid from 'mermaid';\n\nexport type MermaidOptions = {};\n\n/**\n * Extension to create mermaid diagrams.\n */\nexport const mermaid = (_options: MermaidOptions = {}): Extension => {\n return [\n ViewPlugin.fromClass(\n class {\n decorations: DecorationSet;\n\n constructor(view: EditorView) {\n this.decorations = this.buildDecorations(view);\n }\n\n update(update: ViewUpdate) {\n // Always rebuild decorations when selection changes to handle arrow key navigation.\n if (update.docChanged || update.viewportChanged || update.selectionSet || update.focusChanged) {\n this.decorations = this.buildDecorations(update.view);\n }\n }\n\n buildDecorations(view: EditorView): DecorationSet {\n const decorations: Array<{ from: number; to: number; decoration: Decoration }> = [];\n\n syntaxTree(view.state).iterate({\n enter: (node) => {\n if (node.name === 'FencedCode') {\n const cursor = view.state.selection.main.head;\n // Show widget when cursor is outside the code block.\n // Add a buffer of 1 position before and after to handle edge cases.\n const showWidget = view.state.readOnly || cursor < node.from - 1 || cursor > node.to + 1;\n if (showWidget) {\n const info = node.node.getChild('CodeInfo');\n if (info) {\n const type = view.state.sliceDoc(info.from, info.to);\n const text = node.node.getChild('CodeText');\n if (type === 'mermaid' && text) {\n const content = view.state.sliceDoc(text.from, text.to).trim();\n const label = content.split(' ')[0];\n\n // Create widget.\n const widget = new MermaidWidget(`mermaid-${node.from}`, content, label);\n\n // Find the line after the code block to place the widget.\n const endLine = view.state.doc.lineAt(node.to);\n const nextLinePos = endLine.to + 1;\n\n // Add widget after the code block.\n if (nextLinePos <= view.state.doc.length) {\n decorations.push({\n from: nextLinePos,\n to: nextLinePos,\n decoration: Decoration.widget({\n widget,\n }),\n });\n } else {\n // Check if at the end of the document.\n decorations.push({\n from: endLine.to,\n to: endLine.to,\n decoration: Decoration.widget({\n widget,\n side: 1,\n }),\n });\n }\n\n // Hide each line of the code block.\n const startLine = view.state.doc.lineAt(node.from);\n for (let lineNum = startLine.number; lineNum <= endLine.number; lineNum++) {\n const line = view.state.doc.line(lineNum);\n decorations.push({\n from: line.from,\n to: line.from,\n decoration: Decoration.line({\n class: 'cm-mermaid-hidden',\n }),\n });\n }\n }\n }\n }\n }\n },\n });\n\n return Decoration.set(\n decorations.sort((a, b) => a.from - b.from || a.to - b.to).map((d) => d.decoration.range(d.from, d.to)),\n );\n }\n },\n {\n decorations: (v) => v.decorations,\n },\n ),\n EditorView.theme({\n '& .cm-mermaid': {\n position: 'relative',\n display: 'inline-flex',\n width: '100%',\n maring: '4px 0',\n padding: '16px',\n justifyContent: 'center',\n backgroundColor: 'var(--color-group-surface)',\n borderRadius: '8px',\n },\n '& .cm-mermaid-label': {\n position: 'absolute',\n right: '16px',\n fontFamily: 'unset',\n color: 'var(--color-subdued)',\n },\n '& .cm-mermaid-error': {\n display: 'inline-block',\n color: 'var(--color-error)',\n },\n '& .cm-mermaid-hidden': {\n display: 'none !important',\n },\n }),\n ];\n};\n\nclass MermaidWidget extends WidgetType {\n _svg: string | undefined;\n _error: string | undefined;\n\n // TODO(burdon): Mermaid API requires unique id.\n constructor(\n private readonly _id: string,\n private readonly _source: string,\n private readonly _label?: string,\n ) {\n super();\n }\n\n override eq(other: this) {\n return this._source === other._source;\n }\n\n override ignoreEvent(ev: Event) {\n return !/^mouse/.test(ev.type);\n }\n\n override toDOM(view: EditorView) {\n const div = document.createElement('div');\n div.className = 'cm-mermaid';\n\n setTimeout(async () => {\n // https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts\n _mermaid.initialize({\n darkMode: view.state.facet(EditorView.darkTheme),\n theme: 'neutral',\n // TODO(burdon): Styles.\n // NOTE: Must specify 'base' in order to override.\n // theme: 'base',\n // themeVariables: {\n // primaryColor: getToken('extend.colors.red.100'),\n // primaryBorderColor: getToken('extend.colors.neutral.200'),\n // },\n // https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagrams/flowchart/styles.ts\n // https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagrams/sequence/styles.js\n // https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagrams/state/styles.js\n // themeCSS: '.node rect { fill: red; }',\n });\n\n // TODO(burdon): Cache?\n const svg = await this.render(div);\n if (this._error) {\n div.className = 'cm-mermaid-error';\n div.innerText = this._error;\n } else {\n div.className = 'cm-mermaid';\n div.innerHTML = svg!;\n\n if (this._label) {\n const label = document.createElement('span');\n label.innerText = this._label;\n label.className = 'cm-mermaid-label';\n div.appendChild(label);\n view.requestMeasure();\n }\n }\n });\n\n return div;\n }\n\n async render(_container: Element): Promise<string | undefined> {\n try {\n // https://github.com/mermaid-js/mermaid\n const valid = await _mermaid.parse(this._source);\n if (valid) {\n const result = await _mermaid.render(this._id, this._source);\n this._error = undefined;\n this._svg = result.svg;\n return result.svg;\n }\n } catch (err: any) {\n this._error = String(err);\n this._svg = undefined;\n }\n }\n}\n"],
5
- "mappings": "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",
6
- "names": ["Effect", "Capability", "MarkdownCapabilities", "syntaxTree", "Decoration", "EditorView", "ViewPlugin", "WidgetType", "_mermaid", "mermaid", "_options", "fromClass", "decorations", "view", "buildDecorations", "update", "docChanged", "viewportChanged", "selectionSet", "focusChanged", "state", "iterate", "enter", "node", "name", "cursor", "selection", "main", "head", "showWidget", "readOnly", "from", "to", "info", "getChild", "type", "sliceDoc", "text", "content", "trim", "label", "split", "widget", "MermaidWidget", "endLine", "doc", "lineAt", "nextLinePos", "length", "push", "decoration", "side", "startLine", "lineNum", "number", "line", "class", "set", "sort", "a", "b", "map", "d", "range", "v", "theme", "position", "display", "width", "maring", "padding", "justifyContent", "backgroundColor", "borderRadius", "right", "fontFamily", "color", "_svg", "_error", "_id", "_source", "_label", "eq", "other", "ignoreEvent", "ev", "test", "toDOM", "div", "document", "createElement", "className", "setTimeout", "initialize", "darkMode", "facet", "darkTheme", "svg", "render", "innerText", "innerHTML", "appendChild", "requestMeasure", "_container", "valid", "parse", "result", "undefined", "err", "String", "Capability", "makeModule", "succeed", "contributes", "MarkdownCapabilities", "ExtensionProvider", "mermaid"]
7
- }
@@ -1 +0,0 @@
1
- {"inputs":{"dx.config.ts":{"bytes":4579,"imports":[{"path":"@dxos/app-framework/config","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/meta.ts":{"bytes":799,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dx.config.ts","kind":"import-statement","original":"../dx.config"}],"format":"esm"},"src/index.ts":{"bytes":368,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"raw-loader:/__w/dxos/dxos/packages/plugins/plugin-mermaid/PLUGIN.mdl":{"bytes":7350,"imports":[]},"src/MermaidPlugin.tsx":{"bytes":3007,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown","kind":"import-statement","external":true},{"path":"#capabilities","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"raw-loader:/__w/dxos/dxos/packages/plugins/plugin-mermaid/PLUGIN.mdl","kind":"import-statement","original":"../PLUGIN.mdl?raw"}],"format":"esm"},"src/extensions/mermaid-extension.ts":{"bytes":25026,"imports":[{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"mermaid","kind":"import-statement","external":true}],"format":"esm"},"src/extensions/index.ts":{"bytes":401,"imports":[{"path":"src/extensions/mermaid-extension.ts","kind":"import-statement","original":"./mermaid-extension"}],"format":"esm"},"src/capabilities/markdown-extension.ts":{"bytes":1563,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown/types","kind":"import-statement","external":true},{"path":"src/extensions/index.ts","kind":"import-statement","original":"../extensions"}],"format":"esm"},"src/capabilities/index.ts":{"bytes":845,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/capabilities/markdown-extension.ts","kind":"dynamic-import","original":"./markdown-extension"}],"format":"esm"},"src/plugin.ts":{"bytes":860,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"#plugin","kind":"dynamic-import","external":true}],"format":"esm"}},"outputs":{"dist/lib/neutral/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/neutral/index.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-ZBARIEVA.mjs","kind":"import-statement"}],"exports":["meta"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":101},"dist/lib/neutral/MermaidPlugin.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9736},"dist/lib/neutral/MermaidPlugin.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown","kind":"import-statement","external":true},{"path":"#capabilities","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true}],"exports":["MermaidPlugin","default"],"entryPoint":"src/MermaidPlugin.tsx","inputs":{"src/MermaidPlugin.tsx":{"bytesInOutput":621},"raw-loader:/__w/dxos/dxos/packages/plugins/plugin-mermaid/PLUGIN.mdl":{"bytesInOutput":8064}},"bytes":8916},"dist/lib/neutral/capabilities/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":454},"dist/lib/neutral/capabilities/index.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/neutral/markdown-extension-7YWEUNWO.mjs","kind":"dynamic-import"}],"exports":["MarkdownExtension"],"entryPoint":"src/capabilities/index.ts","inputs":{"src/capabilities/index.ts":{"bytesInOutput":164}},"bytes":260},"dist/lib/neutral/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/neutral/meta.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-ZBARIEVA.mjs","kind":"import-statement"}],"exports":["meta"],"entryPoint":"src/meta.ts","inputs":{},"bytes":100},"dist/lib/neutral/plugin.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":443},"dist/lib/neutral/plugin.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-ZBARIEVA.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"#plugin","kind":"dynamic-import","external":true}],"exports":["MermaidPlugin"],"entryPoint":"src/plugin.ts","inputs":{"src/plugin.ts":{"bytesInOutput":110}},"bytes":239},"dist/lib/neutral/chunk-ZBARIEVA.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2429},"dist/lib/neutral/chunk-ZBARIEVA.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-framework/config","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["meta"],"inputs":{"src/meta.ts":{"bytesInOutput":102},"dx.config.ts":{"bytesInOutput":1612}},"bytes":1826},"dist/lib/neutral/markdown-extension-7YWEUNWO.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":12975},"dist/lib/neutral/markdown-extension-7YWEUNWO.mjs":{"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown/types","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"mermaid","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/capabilities/markdown-extension.ts","inputs":{"src/capabilities/markdown-extension.ts":{"bytesInOutput":316},"src/extensions/mermaid-extension.ts":{"bytesInOutput":5273},"src/extensions/index.ts":{"bytesInOutput":0}},"bytes":5823}}}
@@ -1,7 +0,0 @@
1
- import {
2
- meta
3
- } from "./chunk-ZBARIEVA.mjs";
4
- export {
5
- meta
6
- };
7
- //# sourceMappingURL=meta.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,11 +0,0 @@
1
- import {
2
- meta
3
- } from "./chunk-ZBARIEVA.mjs";
4
-
5
- // src/plugin.ts
6
- import { Plugin } from "@dxos/app-framework";
7
- var MermaidPlugin = Plugin.lazy(meta, () => import("#plugin"));
8
- export {
9
- MermaidPlugin
10
- };
11
- //# sourceMappingURL=plugin.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/plugin.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\nexport const MermaidPlugin = Plugin.lazy(meta, () => import('#plugin'));\n"],
5
- "mappings": ";;;;;AAIA,SAASA,cAAc;AAIhB,IAAMC,gBAAgBC,OAAOC,KAAKC,MAAM,MAAM,OAAO,SAAA,CAAA;",
6
- "names": ["Plugin", "MermaidPlugin", "Plugin", "lazy", "meta"]
7
- }