backstage-plugin-techdocs-addon-mermaid 0.19.0 → 0.21.0
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/README.md +41 -0
- package/dist/Mermaid/Mermaid.esm.js +0 -6
- package/dist/Mermaid/Mermaid.esm.js.map +1 -1
- package/dist/Mermaid/hooks.esm.js.map +1 -1
- package/dist/index.d.ts +3 -18
- package/dist/index.esm.js +0 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/plugin.esm.js.map +1 -1
- package/package.json +29 -19
- package/dist/alpha.esm.js +0 -20
- package/dist/alpha.esm.js.map +0 -1
- package/src/index.ts +0 -17
package/README.md
CHANGED
|
@@ -74,6 +74,47 @@ graph TD;
|
|
|
74
74
|
|
|
75
75
|
~~~
|
|
76
76
|
|
|
77
|
+
## Zoom and Pan Functionality
|
|
78
|
+
|
|
79
|
+
The plugin supports interactive zoom and pan functionality for Mermaid diagrams. This allows users to:
|
|
80
|
+
- Zoom in/out using Ctrl/Cmd + mouse wheel
|
|
81
|
+
- Pan the diagram using Ctrl/Cmd + mouse drag
|
|
82
|
+
|
|
83
|
+
### Zoom Configuration Options
|
|
84
|
+
|
|
85
|
+
The zoom functionality can be configured using the following options:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
interface ZoomOptions {
|
|
89
|
+
/**
|
|
90
|
+
* Defines the minimum and maximum zoom scale limits.
|
|
91
|
+
* Example: [0.1, 10] allows zooming out to 10% and in to 1000%
|
|
92
|
+
* Default: [0.1, 10]
|
|
93
|
+
*/
|
|
94
|
+
scaleExtent?: [number, number];
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Defines the boundaries for panning the diagram.
|
|
98
|
+
* Format: [[xmin, ymin], [xmax, ymax]]
|
|
99
|
+
* Example: [[-1000, -1000], [1000, 1000]] limits panning to a 2000x2000 area
|
|
100
|
+
* Default: No limits
|
|
101
|
+
*/
|
|
102
|
+
translateExtent?: [[number, number], [number, number]];
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
To enable zoom functionality, add the `enableZoom` prop and optionally configure the zoom behavior:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
<Mermaid
|
|
110
|
+
enableZoom
|
|
111
|
+
zoomOptions={{
|
|
112
|
+
scaleExtent: [0.1, 10], // Optional: Set min/max zoom scale
|
|
113
|
+
translateExtent: [[-1000, -1000], [1000, 1000]] // Optional: Set pan boundaries
|
|
114
|
+
}}
|
|
115
|
+
/>
|
|
116
|
+
```
|
|
117
|
+
|
|
77
118
|
## Auto-Detection vs. Manual Detection
|
|
78
119
|
|
|
79
120
|
By default, this plugin will autodetect diagrams based on the starting token of the code block. In some cases, however, this auto-detection is not sufficient, for example, because of an unrecognized
|
|
@@ -35,12 +35,6 @@ const MermaidAddon = (properties) => {
|
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
const config = selectConfig(theme.palette.type, properties);
|
|
38
|
-
if (properties.iconLoaders) {
|
|
39
|
-
mermaid.registerIconPacks(properties.iconLoaders);
|
|
40
|
-
}
|
|
41
|
-
if (properties.layoutLoaders) {
|
|
42
|
-
mermaid.registerLayoutLoaders(properties.layoutLoaders);
|
|
43
|
-
}
|
|
44
38
|
mermaid.initialize(config);
|
|
45
39
|
setInitialized(true);
|
|
46
40
|
}, [initialized]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mermaid.esm.js","sources":["../../src/Mermaid/Mermaid.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useState } from 'react';\nimport { PaletteType, useTheme } from '@material-ui/core';\n\nimport { useShadowRootElements } from '@backstage/plugin-techdocs-react';\nimport mermaid
|
|
1
|
+
{"version":3,"file":"Mermaid.esm.js","sources":["../../src/Mermaid/Mermaid.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useState } from 'react';\nimport { PaletteType, useTheme } from '@material-ui/core';\n\nimport { useShadowRootElements } from '@backstage/plugin-techdocs-react';\nimport mermaid from 'mermaid'\nimport { isMermaidCode } from './hooks';\nimport { MermaidProps } from './props';\nimport { BackstageTheme } from '@backstage/theme';\nimport { MermaidConfig } from 'mermaid';\n\nexport function selectConfig(backstagePalette: PaletteType, properties: MermaidProps): MermaidConfig {\n // Theme set directly in the Mermaid configuration takes\n // precedence for backwards-compatibility\n if(properties.config) {\n return properties.config;\n }\n\n if(backstagePalette === 'light') {\n return properties.lightConfig || {};\n }\n\n return Object.assign({ theme: 'dark' }, properties.darkConfig);\n}\n\n/**\n * Show report issue button when text is highlighted\n */\n\nlet diagramId = 0\n\nconst makeDiagram = async (el: HTMLDivElement | HTMLPreElement, diagramText: string) => {\n el.style.display = 'none'\n\n const diagramElement = document.createElement('div')\n diagramElement.className = \"mermaid\"\n\n el.parentNode?.insertBefore(diagramElement, el.nextSibling);\n\n const id = `mermaid-${diagramId++}`\n const { svg, bindFunctions } = await mermaid.render(id, diagramText);\n diagramElement.innerHTML = svg\n bindFunctions?.(diagramElement);\n}\n\nexport const MermaidAddon = (properties: MermaidProps) => {\n const highlightTables = useShadowRootElements<HTMLDivElement>(['.highlighttable']);\n const highlightDivs = useShadowRootElements<HTMLDivElement>(['.highlight']);\n const mermaidPreBlocks = useShadowRootElements<HTMLPreElement>(['.mermaid']);\n const theme = useTheme<BackstageTheme>();\n \n\n const [ initialized, setInitialized ] = useState(false);\n\n useEffect(() => {\n if (initialized) {\n return;\n }\n const config = selectConfig(theme.palette.type, properties);\n mermaid.initialize(config);\n setInitialized(true);\n }, [initialized]);\n\n useEffect(() => {\n if (!initialized) {\n return;\n }\n\n highlightTables.forEach(highlightTable => {\n if (!highlightTable.classList.contains('language-text')) {\n return;\n }\n\n // Skip already processed\n if (highlightTable.style.display === 'none') {\n return\n }\n\n const codeBlock = highlightTable.querySelector('code')\n if (!codeBlock) {\n return\n }\n\n const diagramText = codeBlock.textContent || ''\n\n // Ideally we could detect mermaid based on some annotation, but use a regex for now\n if (!isMermaidCode(diagramText)) {\n return\n }\n\n makeDiagram(highlightTable, diagramText)\n });\n }, [initialized, highlightTables]);\n\n useEffect(() => {\n if (!initialized) {\n return;\n }\n\n highlightDivs.forEach(highlightDiv => {\n if (!highlightDiv.classList.contains('language-text')) {\n return;\n }\n\n // Skip already processed\n if (highlightDiv.style.display === 'none') {\n return\n }\n\n // skip mkdocs-material < 9 code blocks (handled above)\n const table = highlightDiv.querySelector('table')\n if (!table) {\n return\n }\n\n const codeBlock = highlightDiv.querySelector('code')\n if (!codeBlock) {\n return\n }\n\n const diagramText = codeBlock.textContent || ''\n\n // Ideally we could detect mermaid based on some annotation, but use a regex for now\n if (!isMermaidCode(diagramText)) {\n return\n }\n\n makeDiagram(highlightDiv, diagramText)\n });\n }, [initialized, highlightDivs]);\n\n useEffect(() => {\n if (!initialized) {\n return;\n }\n\n mermaidPreBlocks.forEach(mermaidPreBlock => {\n // Skip already processed\n if (mermaidPreBlock.style.display === 'none') {\n return\n }\n\n const codeBlock = mermaidPreBlock.querySelector('code')\n if (!codeBlock) {\n return\n }\n\n const diagramText = codeBlock.textContent || ''\n\n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OAAA;AAAA,OACF;AAEA,MAAM,MAAA,SAAA,GAAY,eAAgB,CAAA,aAAA,CAAc,MAAM,CAAA,CAAA;AACtD,MAAA,IAAI,CAAC,SAAW,EAAA;AACd,QAAA,OAAA;AAAA,OACF;AAEA,MAAM,MAAA,WAAA,GAAc,UAAU,WAAe,IAAA,EAAA,CAAA;AAE7C,MAAA,WAAA,CAAY,iBAAiB,WAAW,CAAA,CAAA;AAAA,KACzC,CAAA,CAAA;AAAA,GACA,EAAA,CAAC,WAAa,EAAA,gBAAgB,CAAC,CAAA,CAAA;AAElC,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.esm.js","sources":["../../src/Mermaid/hooks.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport mermaid from 'mermaid'\n\nexport const isMermaidCode = (code: string): boolean => {\n try {\n mermaid.detectType(code)\n return true\n } catch (_) {\n return false\n }\n};\n"],"names":[],"mappings":";;AAkBa,MAAA,aAAA,GAAgB,CAAC,IAA0B,KAAA;AACtD,EAAI,IAAA;AACF,IAAA,OAAA,CAAQ,WAAW,IAAI,CAAA;AACvB,IAAO,OAAA,IAAA;AAAA,WACA,CAAG,EAAA;AACV,IAAO,OAAA,KAAA;AAAA;
|
|
1
|
+
{"version":3,"file":"hooks.esm.js","sources":["../../src/Mermaid/hooks.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport mermaid from 'mermaid'\n\nexport const isMermaidCode = (code: string): boolean => {\n try {\n mermaid.detectType(code)\n return true\n } catch (_) {\n return false\n }\n};\n"],"names":[],"mappings":";;AAkBa,MAAA,aAAA,GAAgB,CAAC,IAA0B,KAAA;AACtD,EAAI,IAAA;AACF,IAAA,OAAA,CAAQ,WAAW,IAAI,CAAA,CAAA;AACvB,IAAO,OAAA,IAAA,CAAA;AAAA,WACA,CAAG,EAAA;AACV,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AACF;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
2
|
-
import { MermaidConfig
|
|
3
|
-
import { IconLoader } from 'mermaid/dist/rendering-util/icons';
|
|
4
|
-
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
5
|
-
import { TechDocsAddonOptions } from '@backstage/plugin-techdocs-react/alpha';
|
|
3
|
+
import { MermaidConfig } from 'mermaid';
|
|
6
4
|
|
|
7
5
|
type MermaidProps = {
|
|
8
6
|
lightConfig?: MermaidConfig;
|
|
9
7
|
darkConfig?: MermaidConfig;
|
|
10
8
|
config?: MermaidConfig;
|
|
11
|
-
iconLoaders?: IconLoader[];
|
|
12
|
-
layoutLoaders?: LayoutLoaderDefinition[];
|
|
13
9
|
};
|
|
14
10
|
|
|
15
11
|
/**
|
|
@@ -25,15 +21,4 @@ declare const techdocsAddonMermaidPlugin: _backstage_core_plugin_api.BackstagePl
|
|
|
25
21
|
*/
|
|
26
22
|
declare const Mermaid: (props: MermaidProps) => JSX.Element | null;
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
kind: "addon";
|
|
30
|
-
name: "mermaid";
|
|
31
|
-
config: {};
|
|
32
|
-
configInput: {};
|
|
33
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<TechDocsAddonOptions, "techdocs.addon", {}>;
|
|
34
|
-
inputs: {};
|
|
35
|
-
params: TechDocsAddonOptions;
|
|
36
|
-
}>;
|
|
37
|
-
declare const techDocsMermaidAddonModule: _backstage_frontend_plugin_api.FrontendModule;
|
|
38
|
-
|
|
39
|
-
export { Mermaid, techDocsMermaidAddon, techDocsMermaidAddonModule, techdocsAddonMermaidPlugin };
|
|
24
|
+
export { Mermaid, techdocsAddonMermaidPlugin };
|
package/dist/index.esm.js
CHANGED
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createPlugin } from '@backstage/core-plugin-api';\nimport {\n createTechDocsAddonExtension,\n TechDocsAddonLocations,\n} from '@backstage/plugin-techdocs-react';\n\nimport { MermaidAddon } from './Mermaid';\nimport type { MermaidProps } from './Mermaid';\n\n/**\n * The TechDocs addons mermaid plugin\n *\n * @public\n */\n\n\nexport const techdocsAddonMermaidPlugin = createPlugin({\n id: 'techdocs-addon-mermaid',\n});\n\n/**\n * TechDocs addon that lets you render Mermaid diagrams\n *\n * @public\n */\n\n export const Mermaid = techdocsAddonMermaidPlugin.provide(\n createTechDocsAddonExtension<MermaidProps>({\n name: 'MermaidDiagram',\n location: TechDocsAddonLocations.Content,\n component: MermaidAddon,\n }),\n);\n"],"names":[],"mappings":";;;;AA+BO,MAAM,6BAA6B,YAAa,CAAA;AAAA,EACrD,EAAI,EAAA;AACN,CAAC;AAQO,MAAM,UAAU,0BAA2B,CAAA,OAAA;AAAA,EACjD,4BAA2C,CAAA;AAAA,IACzC,IAAM,EAAA,gBAAA;AAAA,IACN,UAAU,sBAAuB,CAAA,OAAA;AAAA,IACjC,SAAW,EAAA;AAAA,GACZ;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createPlugin } from '@backstage/core-plugin-api';\nimport {\n createTechDocsAddonExtension,\n TechDocsAddonLocations,\n} from '@backstage/plugin-techdocs-react';\n\nimport { MermaidAddon } from './Mermaid';\nimport type { MermaidProps } from './Mermaid';\n\n/**\n * The TechDocs addons mermaid plugin\n *\n * @public\n */\n\n\nexport const techdocsAddonMermaidPlugin = createPlugin({\n id: 'techdocs-addon-mermaid',\n});\n\n/**\n * TechDocs addon that lets you render Mermaid diagrams\n *\n * @public\n */\n\n export const Mermaid = techdocsAddonMermaidPlugin.provide(\n createTechDocsAddonExtension<MermaidProps>({\n name: 'MermaidDiagram',\n location: TechDocsAddonLocations.Content,\n component: MermaidAddon,\n }),\n);\n"],"names":[],"mappings":";;;;AA+BO,MAAM,6BAA6B,YAAa,CAAA;AAAA,EACrD,EAAI,EAAA,wBAAA;AACN,CAAC,EAAA;AAQO,MAAM,UAAU,0BAA2B,CAAA,OAAA;AAAA,EACjD,4BAA2C,CAAA;AAAA,IACzC,IAAM,EAAA,gBAAA;AAAA,IACN,UAAU,sBAAuB,CAAA,OAAA;AAAA,IACjC,SAAW,EAAA,YAAA;AAAA,GACZ,CAAA;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backstage-plugin-techdocs-addon-mermaid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"main": "dist/index.esm.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,34 +32,44 @@
|
|
|
32
32
|
"postpack": "backstage-cli package postpack"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@backstage/core-components": "^0.17.
|
|
36
|
-
"@backstage/core-plugin-api": "^1.10.
|
|
37
|
-
"@backstage/frontend-plugin-api": "^0.10.
|
|
38
|
-
"@backstage/plugin-techdocs-react": "^1.2.
|
|
39
|
-
"@backstage/theme": "^0.6.
|
|
35
|
+
"@backstage/core-components": "^0.17.2",
|
|
36
|
+
"@backstage/core-plugin-api": "^1.10.7",
|
|
37
|
+
"@backstage/frontend-plugin-api": "^0.10.2",
|
|
38
|
+
"@backstage/plugin-techdocs-react": "^1.2.17",
|
|
39
|
+
"@backstage/theme": "^0.6.6",
|
|
40
40
|
"@material-ui/core": "^4.12.2",
|
|
41
41
|
"@material-ui/icons": "^4.11.3",
|
|
42
42
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
43
|
-
"
|
|
43
|
+
"d3": "^7.9.0",
|
|
44
|
+
"d3-selection": "^3.0.0",
|
|
45
|
+
"d3-zoom": "^3.0.0",
|
|
46
|
+
"mermaid": "^11.6.0",
|
|
44
47
|
"react-use": "^17.2.4"
|
|
45
48
|
},
|
|
46
49
|
"peerDependencies": {
|
|
47
|
-
"react": "^
|
|
48
|
-
"react
|
|
50
|
+
"@types/react": "^17.0.0 || ^18.0.0",
|
|
51
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
52
|
+
"react-dom": "^17.0.0 || ^18.0.0",
|
|
49
53
|
"react-router-dom": "^6.3.0"
|
|
50
54
|
},
|
|
55
|
+
"peerDependenciesMeta": {
|
|
56
|
+
"@types/react": {
|
|
57
|
+
"optional": true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
51
60
|
"devDependencies": {
|
|
52
|
-
"@backstage/cli": "^0.32.
|
|
53
|
-
"@backstage/core-app-api": "^1.
|
|
54
|
-
"@backstage/dev-utils": "^1.1.
|
|
55
|
-
"@backstage/plugin-techdocs-addons-test-utils": "^1.0.
|
|
56
|
-
"@backstage/test-utils": "^1.7.
|
|
61
|
+
"@backstage/cli": "^0.32.1",
|
|
62
|
+
"@backstage/core-app-api": "^1.17.0",
|
|
63
|
+
"@backstage/dev-utils": "^1.1.10",
|
|
64
|
+
"@backstage/plugin-techdocs-addons-test-utils": "^1.0.48",
|
|
65
|
+
"@backstage/test-utils": "^1.7.8",
|
|
57
66
|
"@date-io/core": "^1.3.13",
|
|
58
67
|
"@svgr/core": "^6.0.0",
|
|
59
|
-
"@testing-library/dom": "^
|
|
68
|
+
"@testing-library/dom": "^10.0.0",
|
|
60
69
|
"@testing-library/jest-dom": "^6.0.0",
|
|
61
|
-
"@testing-library/react": "^
|
|
70
|
+
"@testing-library/react": "^16.0.0",
|
|
62
71
|
"@testing-library/user-event": "^14.0.0",
|
|
72
|
+
"@types/d3": "^7.4.3",
|
|
63
73
|
"@types/jest": "*",
|
|
64
74
|
"@types/node": "*",
|
|
65
75
|
"@types/react": "^18.3.12",
|
|
@@ -68,7 +78,7 @@
|
|
|
68
78
|
"react": "^18.3.1",
|
|
69
79
|
"react-dom": "^18.3.1",
|
|
70
80
|
"react-router-dom": "^6.3.0",
|
|
71
|
-
"typescript": "~5.
|
|
81
|
+
"typescript": "~5.6.0"
|
|
72
82
|
},
|
|
73
83
|
"files": [
|
|
74
84
|
"dist"
|
|
@@ -78,7 +88,7 @@
|
|
|
78
88
|
"url": "https://github.com/johanneswuerbach/backstage-plugin-techdocs-addon-mermaid",
|
|
79
89
|
"directory": "."
|
|
80
90
|
},
|
|
81
|
-
"packageManager": "yarn@
|
|
91
|
+
"packageManager": "yarn@4.8.1",
|
|
82
92
|
"typesVersions": {
|
|
83
93
|
"*": {
|
|
84
94
|
"package.json": [
|
|
@@ -87,4 +97,4 @@
|
|
|
87
97
|
}
|
|
88
98
|
},
|
|
89
99
|
"module": "./dist/index.esm.js"
|
|
90
|
-
}
|
|
100
|
+
}
|
package/dist/alpha.esm.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AddonBlueprint } from '@backstage/plugin-techdocs-react/alpha';
|
|
2
|
-
import { MermaidAddon } from './Mermaid/Mermaid.esm.js';
|
|
3
|
-
import { createFrontendModule } from '@backstage/frontend-plugin-api';
|
|
4
|
-
|
|
5
|
-
const mermaidAddonParams = {
|
|
6
|
-
name: "Mermaid",
|
|
7
|
-
location: "Content",
|
|
8
|
-
component: MermaidAddon
|
|
9
|
-
};
|
|
10
|
-
const techDocsMermaidAddon = AddonBlueprint.make({
|
|
11
|
-
name: "mermaid",
|
|
12
|
-
params: mermaidAddonParams
|
|
13
|
-
});
|
|
14
|
-
const techDocsMermaidAddonModule = createFrontendModule({
|
|
15
|
-
pluginId: "techdocs",
|
|
16
|
-
extensions: [techDocsMermaidAddon]
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export { techDocsMermaidAddon, techDocsMermaidAddonModule };
|
|
20
|
-
//# sourceMappingURL=alpha.esm.js.map
|
package/dist/alpha.esm.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.ts"],"sourcesContent":["import {\n AddonBlueprint,\n TechDocsAddonOptions,\n} from \"@backstage/plugin-techdocs-react/alpha\";\nimport { MermaidAddon } from \"./Mermaid\";\nimport { createFrontendModule } from \"@backstage/frontend-plugin-api\";\n\nconst mermaidAddonParams: TechDocsAddonOptions = {\n name: \"Mermaid\",\n location: \"Content\",\n component: MermaidAddon,\n};\n\nexport const techDocsMermaidAddon = AddonBlueprint.make({\n name: \"mermaid\",\n params: mermaidAddonParams,\n});\n\nexport const techDocsMermaidAddonModule = createFrontendModule({\n pluginId: \"techdocs\",\n extensions: [techDocsMermaidAddon],\n});\n"],"names":[],"mappings":";;;;AAOA,MAAM,kBAA2C,GAAA;AAAA,EAC/C,IAAM,EAAA,SAAA;AAAA,EACN,QAAU,EAAA,SAAA;AAAA,EACV,SAAW,EAAA;AACb,CAAA;AAEa,MAAA,oBAAA,GAAuB,eAAe,IAAK,CAAA;AAAA,EACtD,IAAM,EAAA,SAAA;AAAA,EACN,MAAQ,EAAA;AACV,CAAC;AAEM,MAAM,6BAA6B,oBAAqB,CAAA;AAAA,EAC7D,QAAU,EAAA,UAAA;AAAA,EACV,UAAA,EAAY,CAAC,oBAAoB;AACnC,CAAC;;;;"}
|
package/src/index.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2022 The Backstage Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
export { techdocsAddonMermaidPlugin, Mermaid } from "./plugin";
|
|
17
|
-
export { techDocsMermaidAddon, techDocsMermaidAddonModule } from "./alpha";
|