@dxos/plugin-mermaid 0.8.3-staging.0fa589b → 0.8.4-main.1068cf700f

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.
@@ -1,56 +1,128 @@
1
- // packages/plugins/plugin-mermaid/src/MermaidPlugin.tsx
2
- import { contributes, defineModule, definePlugin } from "@dxos/app-framework";
1
+ // src/MermaidPlugin.tsx
2
+ import * as Effect from "effect/Effect";
3
+ import { Capability, Plugin } from "@dxos/app-framework";
3
4
  import { MarkdownCapabilities, MarkdownEvents } from "@dxos/plugin-markdown";
4
5
 
5
- // packages/plugins/plugin-mermaid/src/extensions/mermaid.ts
6
+ // src/extensions/mermaid-extension.ts
6
7
  import { syntaxTree } from "@codemirror/language";
7
- import { RangeSetBuilder, StateField } from "@codemirror/state";
8
- import { Decoration, EditorView, WidgetType } from "@codemirror/view";
8
+ import { Decoration, EditorView, ViewPlugin, WidgetType } from "@codemirror/view";
9
9
  import _mermaid from "mermaid";
10
- var mermaid = (options = {}) => {
10
+ var mermaid = (_options = {}) => {
11
11
  return [
12
- StateField.define({
13
- create: (state) => update(state, options),
14
- update: (_, tr) => update(tr.state, options),
15
- provide: (field) => EditorView.decorations.from(field)
16
- }),
17
- styles
18
- ];
19
- };
20
- var update = (state, options) => {
21
- const builder = new RangeSetBuilder();
22
- syntaxTree(state).iterate({
23
- enter: (node) => {
24
- if (node.name === "FencedCode") {
25
- const cursor = state.selection.main.head;
26
- if (state.readOnly || cursor < node.from || cursor > node.to) {
27
- const info = node.node.getChild("CodeInfo");
28
- if (info) {
29
- const type = state.sliceDoc(info.from, info.to);
30
- const text = node.node.getChild("CodeText");
31
- if (type === "mermaid" && text) {
32
- const content = state.sliceDoc(text.from, text.to);
33
- builder.add(node.from, node.to, Decoration.replace({
34
- widget: new MermaidWidget(`mermaid-${node.from}`, content)
35
- }));
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
+ }
36
72
  }
37
73
  }
38
- }
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)));
39
76
  }
40
- }
41
- });
42
- return builder.finish();
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(--dx-groupSurface)",
89
+ borderRadius: "8px"
90
+ },
91
+ "& .cm-mermaid-label": {
92
+ position: "absolute",
93
+ right: "16px",
94
+ fontFamily: "unset",
95
+ color: "var(--dx-subdued)"
96
+ },
97
+ "& .cm-mermaid-error": {
98
+ display: "inline-block",
99
+ color: "var(--dx-errorText)"
100
+ },
101
+ "& .cm-mermaid-hidden": {
102
+ display: "none !important"
103
+ }
104
+ })
105
+ ];
43
106
  };
44
107
  var MermaidWidget = class extends WidgetType {
108
+ _id;
109
+ _source;
110
+ _label;
111
+ _svg;
112
+ _error;
45
113
  // TODO(burdon): Mermaid API requires unique id.
46
- constructor(_id, _source) {
47
- super(), this._id = _id, this._source = _source;
114
+ constructor(_id, _source, _label) {
115
+ super(), this._id = _id, this._source = _source, this._label = _label;
48
116
  }
49
117
  eq(other) {
50
118
  return this._source === other._source;
51
119
  }
120
+ ignoreEvent(ev) {
121
+ return !/^mouse/.test(ev.type);
122
+ }
52
123
  toDOM(view) {
53
124
  const div = document.createElement("div");
125
+ div.className = "cm-mermaid";
54
126
  setTimeout(async () => {
55
127
  _mermaid.initialize({
56
128
  darkMode: view.state.facet(EditorView.darkTheme),
@@ -63,12 +135,18 @@ var MermaidWidget = class extends WidgetType {
63
135
  } else {
64
136
  div.className = "cm-mermaid";
65
137
  div.innerHTML = svg;
66
- view.requestMeasure();
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
+ }
67
145
  }
68
146
  });
69
147
  return div;
70
148
  }
71
- async render(container) {
149
+ async render(_container) {
72
150
  try {
73
151
  const valid = await _mermaid.parse(this._source);
74
152
  if (valid) {
@@ -82,50 +160,30 @@ var MermaidWidget = class extends WidgetType {
82
160
  this._svg = void 0;
83
161
  }
84
162
  }
85
- ignoreEvent(e) {
86
- return !/^mouse/.test(e.type);
87
- }
88
163
  };
89
- var styles = EditorView.theme({
90
- "& .cm-mermaid": {
91
- position: "relative",
92
- display: "inline-flex",
93
- width: "100%",
94
- justifyContent: "center"
95
- },
96
- // '& .cm-mermaid-label': {
97
- // position: 'absolute',
98
- // right: 0,
99
- // textSize: 10,
100
- // },
101
- "& .cm-mermaid-error": {
102
- display: "inline-block",
103
- color: "var(--dx-errorText)"
104
- }
105
- });
106
164
 
107
- // packages/plugins/plugin-mermaid/src/meta.ts
108
- var MERMAID_PLUGIN = "dxos.org/plugin/mermaid";
165
+ // src/meta.ts
166
+ import { trim } from "@dxos/util";
109
167
  var meta = {
110
- id: MERMAID_PLUGIN,
168
+ id: "dxos.org/plugin/mermaid",
111
169
  name: "Mermaid",
112
- description: "Tool that renders text definitions to create diagrams.",
170
+ description: trim`
171
+ Generate diagrams from simple text-based definitions using Mermaid syntax.
172
+ Create flowcharts, sequence diagrams, and other visualizations that stay in sync with your documentation.
173
+ `,
113
174
  icon: "ph--anchor-simple--regular",
114
175
  source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-mermaid"
115
176
  };
116
177
 
117
- // packages/plugins/plugin-mermaid/src/MermaidPlugin.tsx
118
- var MermaidPlugin = () => definePlugin(meta, [
119
- defineModule({
120
- id: `${meta.id}/module/markdown`,
121
- activatesOn: MarkdownEvents.SetupExtensions,
122
- activate: () => contributes(MarkdownCapabilities.Extensions, [
123
- mermaid
124
- ])
125
- })
126
- ]);
178
+ // src/MermaidPlugin.tsx
179
+ var MermaidPlugin = Plugin.define(meta).pipe(Plugin.addModule({
180
+ id: "markdown",
181
+ activatesOn: MarkdownEvents.SetupExtensions,
182
+ activate: () => Effect.succeed(Capability.contributes(MarkdownCapabilities.Extensions, [
183
+ mermaid
184
+ ]))
185
+ }), Plugin.make);
127
186
  export {
128
- MERMAID_PLUGIN,
129
187
  MermaidPlugin,
130
188
  meta
131
189
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/MermaidPlugin.tsx", "../../../src/extensions/mermaid.ts", "../../../src/meta.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { contributes, defineModule, definePlugin } from '@dxos/app-framework';\nimport { MarkdownCapabilities, MarkdownEvents } from '@dxos/plugin-markdown';\n\nimport { mermaid } from './extensions';\nimport { meta } from './meta';\n\nexport const MermaidPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/markdown`,\n activatesOn: MarkdownEvents.SetupExtensions,\n activate: () => contributes(MarkdownCapabilities.Extensions, [mermaid]),\n }),\n ]);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { syntaxTree } from '@codemirror/language';\nimport {\n type EditorState,\n type Extension,\n type RangeSet,\n RangeSetBuilder,\n StateField,\n type Transaction,\n} from '@codemirror/state';\nimport { Decoration, EditorView, WidgetType } from '@codemirror/view';\nimport _mermaid from 'mermaid';\n\nexport type MermaidOptions = {};\n\nexport const mermaid = (options: MermaidOptions = {}): Extension => {\n return [\n StateField.define<RangeSet<Decoration>>({\n create: (state) => update(state, options),\n update: (_: RangeSet<Decoration>, tr: Transaction) => update(tr.state, options),\n provide: (field) => EditorView.decorations.from(field),\n }),\n styles,\n ];\n};\n\nconst update = (state: EditorState, options: MermaidOptions) => {\n const builder = new RangeSetBuilder<Decoration>();\n syntaxTree(state).iterate({\n enter: (node) => {\n if (node.name === 'FencedCode') {\n const cursor = state.selection.main.head;\n if (state.readOnly || cursor < node.from || cursor > node.to) {\n const info = node.node.getChild('CodeInfo');\n if (info) {\n const type = state.sliceDoc(info.from, info.to);\n const text = node.node.getChild('CodeText');\n if (type === 'mermaid' && text) {\n const content = state.sliceDoc(text.from, text.to);\n // TODO(burdon): Error if extension defined AFTER decorateMarkdown.\n // Decorations that replace line breaks may not be specified via plugins\n builder.add(\n node.from,\n node.to,\n Decoration.replace({\n widget: new MermaidWidget(`mermaid-${node.from}`, content),\n }),\n );\n }\n }\n }\n }\n },\n });\n\n return builder.finish();\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 ) {\n super();\n }\n\n override eq(other: this): boolean {\n return this._source === other._source;\n }\n\n override toDOM(view: EditorView): HTMLDivElement {\n const div = document.createElement('div');\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 // const label = document.createElement('span');\n // label.innerText = 'Mermaid';\n // label.className = 'cm-mermaid-label';\n // wrapper.appendChild(label);\n view.requestMeasure();\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 override ignoreEvent(e: Event): boolean {\n return !/^mouse/.test(e.type);\n }\n}\n\nconst styles = EditorView.theme({\n '& .cm-mermaid': {\n position: 'relative',\n display: 'inline-flex',\n width: '100%',\n justifyContent: 'center',\n },\n // '& .cm-mermaid-label': {\n // position: 'absolute',\n // right: 0,\n // textSize: 10,\n // },\n '& .cm-mermaid-error': {\n display: 'inline-block',\n color: 'var(--dx-errorText)',\n },\n});\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const MERMAID_PLUGIN = 'dxos.org/plugin/mermaid';\n\nexport const meta: PluginMeta = {\n id: MERMAID_PLUGIN,\n name: 'Mermaid',\n description: 'Tool that renders text definitions to create diagrams.',\n icon: 'ph--anchor-simple--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-mermaid',\n};\n"],
5
- "mappings": ";AAIA,SAASA,aAAaC,cAAcC,oBAAoB;AACxD,SAASC,sBAAsBC,sBAAsB;;;ACDrD,SAASC,kBAAkB;AAC3B,SAIEC,iBACAC,kBAEK;AACP,SAASC,YAAYC,YAAYC,kBAAkB;AACnD,OAAOC,cAAc;AAId,IAAMC,UAAU,CAACC,UAA0B,CAAC,MAAC;AAClD,SAAO;IACLC,WAAWC,OAA6B;MACtCC,QAAQ,CAACC,UAAUC,OAAOD,OAAOJ,OAAAA;MACjCK,QAAQ,CAACC,GAAyBC,OAAoBF,OAAOE,GAAGH,OAAOJ,OAAAA;MACvEQ,SAAS,CAACC,UAAUC,WAAWC,YAAYC,KAAKH,KAAAA;IAClD,CAAA;IACAI;;AAEJ;AAEA,IAAMR,SAAS,CAACD,OAAoBJ,YAAAA;AAClC,QAAMc,UAAU,IAAIC,gBAAAA;AACpBC,aAAWZ,KAAAA,EAAOa,QAAQ;IACxBC,OAAO,CAACC,SAAAA;AACN,UAAIA,KAAKC,SAAS,cAAc;AAC9B,cAAMC,SAASjB,MAAMkB,UAAUC,KAAKC;AACpC,YAAIpB,MAAMqB,YAA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KxB,OAAO;AAC/C,UAAIuB,OAAO;AACT,cAAME,SAAS,MAAMhB,SAASO,OAAO,KAAKjB,KAAK,KAAKC,OAAO;AAC3D,aAAKiB,SAASS;AACd,aAAKC,OAAOF,OAAOV;AACnB,eAAOU,OAAOV;MAChB;IACF,SAASa,KAAU;AACjB,WAAKX,SAASY,OAAOD,GAAAA;AACrB,WAAKD,OAAOD;IACd;EACF;EAESI,YAAYC,GAAmB;AACtC,WAAO,CAAC,SAASC,KAAKD,EAAE3C,IAAI;EAC9B;AACF;AAEA,IAAMhB,SAASH,WAAW6C,MAAM;EAC9B,iBAAiB;IACfmB,UAAU;IACVC,SAAS;IACTC,OAAO;IACPC,gBAAgB;EAClB;;;;;;EAMA,uBAAuB;IACrBF,SAAS;IACTG,OAAO;EACT;AACF,CAAA;;;ACpJO,IAAMC,iBAAiB;AAEvB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,aAAa;EACbC,MAAM;EACNC,QAAQ;AACV;;;AFJO,IAAMC,gBAAgB,MAC3BC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,eAAeC;IAC5BC,UAAU,MAAMC,YAAYC,qBAAqBC,YAAY;MAACC;KAAQ;EACxE,CAAA;CACD;",
6
- "names": ["contributes", "defineModule", "definePlugin", "MarkdownCapabilities", "MarkdownEvents", "syntaxTree", "RangeSetBuilder", "StateField", "Decoration", "EditorView", "WidgetType", "_mermaid", "mermaid", "options", "StateField", "define", "create", "state", "update", "_", "tr", "provide", "field", "EditorView", "decorations", "from", "styles", "builder", "RangeSetBuilder", "syntaxTree", "iterate", "enter", "node", "name", "cursor", "selection", "main", "head", "readOnly", "to", "info", "getChild", "type", "sliceDoc", "text", "content", "add", "Decoration", "replace", "widget", "MermaidWidget", "finish", "WidgetType", "_id", "_source", "eq", "other", "toDOM", "view", "div", "document", "createElement", "setTimeout", "_mermaid", "initialize", "darkMode", "facet", "darkTheme", "theme", "svg", "render", "_error", "className", "innerText", "innerHTML", "requestMeasure", "container", "valid", "parse", "result", "undefined", "_svg", "err", "String", "ignoreEvent", "e", "test", "position", "display", "width", "justifyContent", "color", "MERMAID_PLUGIN", "meta", "id", "name", "description", "icon", "source", "MermaidPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "MarkdownEvents", "SetupExtensions", "activate", "contributes", "MarkdownCapabilities", "Extensions", "mermaid"]
3
+ "sources": ["../../../src/MermaidPlugin.tsx", "../../../src/extensions/mermaid-extension.ts", "../../../src/meta.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability, Plugin } from '@dxos/app-framework';\nimport { MarkdownCapabilities, MarkdownEvents } from '@dxos/plugin-markdown';\n\nimport { mermaid } from './extensions';\nimport { meta } from './meta';\n\nexport const MermaidPlugin = Plugin.define(meta).pipe(\n Plugin.addModule({\n id: 'markdown',\n activatesOn: MarkdownEvents.SetupExtensions,\n activate: () => Effect.succeed(Capability.contributes(MarkdownCapabilities.Extensions, [mermaid])),\n }),\n Plugin.make,\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(--dx-groupSurface)',\n borderRadius: '8px',\n },\n '& .cm-mermaid-label': {\n position: 'absolute',\n right: '16px',\n fontFamily: 'unset',\n color: 'var(--dx-subdued)',\n },\n '& .cm-mermaid-error': {\n display: 'inline-block',\n color: 'var(--dx-errorText)',\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", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'dxos.org/plugin/mermaid',\n name: 'Mermaid',\n description: trim`\n Generate diagrams from simple text-based definitions using Mermaid syntax.\n Create flowcharts, sequence diagrams, and other visualizations that stay in sync with your documentation.\n `,\n icon: 'ph--anchor-simple--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-mermaid',\n};\n"],
5
+ "mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,YAAYC,cAAc;AACnC,SAASC,sBAAsBC,sBAAsB;;;ACHrD,SAASC,kBAAkB;AAE3B,SAASC,YAAgCC,YAAYC,YAA6BC,kBAAkB;AACpG,OAAOC,cAAc;AAOd,IAAMC,UAAU,CAACC,WAA2B,CAAC,MAAC;AACnD,SAAO;IACLC,WAAWC,UACT,MAAA;MACEC;MAEA,YAAYC,MAAkB;AAC5B,aAAKD,cAAc,KAAKE,iBAAiBD,IAAAA;MAC3C;MAEAE,OAAOA,QAAoB;AAEzB,YAAIA,OAAOC,cAAcD,OAAOE,mBAAmBF,OAAOG,gBAAgBH,OAAOI,cAAc;AAC7F,eAAKP,cAAc,KAAKE,iBAAiBC,OAAOF,IAAI;QACtD;MACF;MAEAC,iBAAiBD,MAAiC;AAChD,cAAMD,cAA2E,CAAA;AAEjFQ,mBAAWP,KAAKQ,KAAK,EAAEC,QAAQ;UAC7BC,OAAO,CAACC,SAAAA;AACN,gBAAIA,KAAKC,SAAS,cAAc;AAC9B,oBAAMC,SAASb,KAAKQ,MAAMM,UAAUC,KAAKC;AAGzC,oBAAMC,aAAajB,KAAKQ,MAAMU,YAAYL,SAASF,KAAKQ,OAAO,KAAKN,SAASF,KAAKS,KAAK;AACvF,kBAAIH,YAAY;AACd,sB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KAAKtB;MACvB,OAAO;AACLU,YAAIG,YAAY;AAChBH,YAAIa,YAAYH;AAEhB,YAAI,KAAKjB,QAAQ;AACf,gBAAM5C,QAAQoD,SAASC,cAAc,MAAA;AACrCrD,gBAAM+D,YAAY,KAAKnB;AACvB5C,gBAAMsD,YAAY;AAClBH,cAAIc,YAAYjE,KAAAA;AAChB5B,eAAK8F,eAAc;QACrB;MACF;IACF,CAAA;AAEA,WAAOf;EACT;EAEA,MAAMW,OAAOK,YAAkD;AAC7D,QAAI;AAEF,YAAMC,QAAQ,MAAMZ,SAASa,MAAM,KAAK1B,OAAO;AAC/C,UAAIyB,OAAO;AACT,cAAME,SAAS,MAAMd,SAASM,OAAO,KAAKpB,KAAK,KAAKC,OAAO;AAC3D,aAAKF,SAAS8B;AACd,aAAK/B,OAAO8B,OAAOT;AACnB,eAAOS,OAAOT;MAChB;IACF,SAASW,KAAU;AACjB,WAAK/B,SAASgC,OAAOD,GAAAA;AACrB,WAAKhC,OAAO+B;IACd;EACF;AACF;;;ACjNA,SAASG,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,QAAQ;AACV;;;AFJO,IAAMC,gBAAgBC,OAAOC,OAAOC,IAAAA,EAAMC,KAC/CH,OAAOI,UAAU;EACfC,IAAI;EACJC,aAAaC,eAAeC;EAC5BC,UAAU,MAAaC,eAAQC,WAAWC,YAAYC,qBAAqBC,YAAY;IAACC;GAAQ,CAAA;AAClG,CAAA,GACAf,OAAOgB,IAAI;",
6
+ "names": ["Effect", "Capability", "Plugin", "MarkdownCapabilities", "MarkdownEvents", "syntaxTree", "Decoration", "EditorView", "ViewPlugin", "WidgetType", "_mermaid", "mermaid", "_options", "ViewPlugin", "fromClass", "decorations", "view", "buildDecorations", "update", "docChanged", "viewportChanged", "selectionSet", "focusChanged", "syntaxTree", "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", "Decoration", "side", "startLine", "lineNum", "number", "line", "class", "set", "sort", "a", "b", "map", "d", "range", "v", "EditorView", "theme", "position", "display", "width", "maring", "padding", "justifyContent", "backgroundColor", "borderRadius", "right", "fontFamily", "color", "WidgetType", "_svg", "_error", "_id", "_source", "_label", "eq", "other", "ignoreEvent", "ev", "test", "toDOM", "div", "document", "createElement", "className", "setTimeout", "_mermaid", "initialize", "darkMode", "facet", "darkTheme", "svg", "render", "innerText", "innerHTML", "appendChild", "requestMeasure", "_container", "valid", "parse", "result", "undefined", "err", "String", "trim", "meta", "id", "name", "description", "trim", "icon", "source", "MermaidPlugin", "Plugin", "define", "meta", "pipe", "addModule", "id", "activatesOn", "MarkdownEvents", "SetupExtensions", "activate", "succeed", "Capability", "contributes", "MarkdownCapabilities", "Extensions", "mermaid", "make"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/plugins/plugin-mermaid/src/extensions/mermaid.ts":{"bytes":15208,"imports":[{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"mermaid","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-mermaid/src/extensions/index.ts":{"bytes":481,"imports":[{"path":"packages/plugins/plugin-mermaid/src/extensions/mermaid.ts","kind":"import-statement","original":"./mermaid"}],"format":"esm"},"packages/plugins/plugin-mermaid/src/meta.ts":{"bytes":1489,"imports":[],"format":"esm"},"packages/plugins/plugin-mermaid/src/MermaidPlugin.tsx":{"bytes":2315,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-mermaid/src/extensions/index.ts","kind":"import-statement","original":"./extensions"},{"path":"packages/plugins/plugin-mermaid/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-mermaid/src/index.ts":{"bytes":564,"imports":[{"path":"packages/plugins/plugin-mermaid/src/MermaidPlugin.tsx","kind":"import-statement","original":"./MermaidPlugin"},{"path":"packages/plugins/plugin-mermaid/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-mermaid/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9645},"packages/plugins/plugin-mermaid/dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"mermaid","kind":"import-statement","external":true}],"exports":["MERMAID_PLUGIN","MermaidPlugin","meta"],"entryPoint":"packages/plugins/plugin-mermaid/src/index.ts","inputs":{"packages/plugins/plugin-mermaid/src/MermaidPlugin.tsx":{"bytesInOutput":405},"packages/plugins/plugin-mermaid/src/extensions/mermaid.ts":{"bytesInOutput":2870},"packages/plugins/plugin-mermaid/src/extensions/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-mermaid/src/meta.ts":{"bytesInOutput":299},"packages/plugins/plugin-mermaid/src/index.ts":{"bytesInOutput":0}},"bytes":3888}}}
1
+ {"inputs":{"src/extensions/mermaid-extension.ts":{"bytes":25117,"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":494,"imports":[{"path":"src/extensions/mermaid-extension.ts","kind":"import-statement","original":"./mermaid-extension"}],"format":"esm"},"src/meta.ts":{"bytes":1791,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/MermaidPlugin.tsx":{"bytes":2446,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown","kind":"import-statement","external":true},{"path":"src/extensions/index.ts","kind":"import-statement","original":"./extensions"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"src/index.ts":{"bytes":551,"imports":[{"path":"src/MermaidPlugin.tsx","kind":"import-statement","original":"./MermaidPlugin"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14229},"dist/lib/browser/index.mjs":{"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown","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},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["MermaidPlugin","meta"],"entryPoint":"src/index.ts","inputs":{"src/MermaidPlugin.tsx":{"bytesInOutput":433},"src/extensions/mermaid-extension.ts":{"bytesInOutput":5267},"src/extensions/index.ts":{"bytesInOutput":0},"src/meta.ts":{"bytesInOutput":439},"src/index.ts":{"bytesInOutput":0}},"bytes":6317}}}
@@ -1,2 +1,3 @@
1
- export declare const MermaidPlugin: () => import("@dxos/app-framework").Plugin;
1
+ import { Plugin } from '@dxos/app-framework';
2
+ export declare const MermaidPlugin: Plugin.PluginFactory<void>;
2
3
  //# sourceMappingURL=MermaidPlugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MermaidPlugin.d.ts","sourceRoot":"","sources":["../../../src/MermaidPlugin.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,aAAa,4CAOtB,CAAC"}
1
+ {"version":3,"file":"MermaidPlugin.d.ts","sourceRoot":"","sources":["../../../src/MermaidPlugin.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAc,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAMzD,eAAO,MAAM,aAAa,4BAOzB,CAAC"}
@@ -1,2 +1,2 @@
1
- export * from './mermaid';
1
+ export * from './mermaid-extension';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ export type MermaidOptions = {};
3
+ /**
4
+ * Extension to create mermaid diagrams.
5
+ */
6
+ export declare const mermaid: (_options?: MermaidOptions) => Extension;
7
+ //# sourceMappingURL=mermaid-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mermaid-extension.d.ts","sourceRoot":"","sources":["../../../../src/extensions/mermaid-extension.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD,MAAM,MAAM,cAAc,GAAG,EAAE,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,WAAU,cAAmB,KAAG,SAsHvD,CAAC"}
@@ -1,15 +1,15 @@
1
- import '@dxos-theme';
2
- import { type Meta } from '@storybook/react';
3
- export declare const Default: {
4
- args: {
5
- text: string;
6
- };
1
+ import { type StoryObj } from '@storybook/react-vite';
2
+ import React from 'react';
3
+ type StoryProps = {
4
+ text?: string;
7
5
  };
8
- export declare const Error: {
9
- args: {
10
- text: string;
11
- };
6
+ declare const meta: {
7
+ title: string;
8
+ render: ({ text }: StoryProps) => React.JSX.Element;
9
+ decorators: import("@storybook/react").Decorator[];
12
10
  };
13
- declare const meta: Meta;
14
11
  export default meta;
12
+ type Story = StoryObj<typeof meta>;
13
+ export declare const Default: Story;
14
+ export declare const Error: Story;
15
15
  //# sourceMappingURL=mermaid.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mermaid.stories.d.ts","sourceRoot":"","sources":["../../../../src/extensions/mermaid.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAyC7C,eAAO,MAAM,OAAO;;;;CAqBnB,CAAC;AAEF,eAAO,MAAM,KAAK;;;;CAgBjB,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAIX,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"mermaid.stories.d.ts","sourceRoot":"","sources":["../../../../src/extensions/mermaid.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAgB1B,KAAK,UAAU,GAAG;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAqBF,QAAA,MAAM,IAAI;;uBAnBsB,UAAU;;CAuBL,CAAC;AAEtC,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAqBrB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAgBnB,CAAC"}
@@ -1,4 +1,3 @@
1
- import { type PluginMeta } from '@dxos/app-framework';
2
- export declare const MERMAID_PLUGIN = "dxos.org/plugin/mermaid";
3
- export declare const meta: PluginMeta;
1
+ import { type Plugin } from '@dxos/app-framework';
2
+ export declare const meta: Plugin.Meta;
4
3
  //# sourceMappingURL=meta.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,eAAO,MAAM,cAAc,4BAA4B,CAAC;AAExD,eAAO,MAAM,IAAI,EAAE,UAMlB,CAAC"}
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,IASzB,CAAC"}