@barzhsieh/nuxt-content-mermaid 3.0.4 → 4.0.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 +9 -3
- package/README.zh-TW.md +7 -3
- package/dist/module.d.mts +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +9 -5
- package/dist/runtime/built-in-renderer/BuiltInRenderer.vue +2 -4
- package/dist/runtime/components/ContentMermaidTransport.d.vue.ts +3 -1
- package/dist/runtime/components/ContentMermaidTransport.vue +5 -4
- package/dist/runtime/components/ContentMermaidTransport.vue.d.ts +3 -1
- package/dist/runtime/components/Spinner.d.vue.ts +8 -0
- package/dist/runtime/components/Spinner.vue.d.ts +8 -0
- package/dist/runtime/components/icons/IconClipboard.d.vue.ts +1 -1
- package/dist/runtime/components/icons/IconClipboard.vue.d.ts +1 -1
- package/dist/runtime/components/icons/IconClipboardHover.d.vue.ts +1 -1
- package/dist/runtime/components/icons/IconClipboardHover.vue.d.ts +1 -1
- package/dist/runtime/components/icons/IconClipboardSuccess.d.vue.ts +1 -1
- package/dist/runtime/components/icons/IconClipboardSuccess.vue.d.ts +1 -1
- package/dist/runtime/components/icons/IconCollapse.d.vue.ts +1 -1
- package/dist/runtime/components/icons/IconCollapse.vue.d.ts +1 -1
- package/dist/runtime/components/icons/IconDownload.d.vue.ts +1 -1
- package/dist/runtime/components/icons/IconDownload.vue.d.ts +1 -1
- package/dist/runtime/components/icons/IconExpand.d.vue.ts +1 -1
- package/dist/runtime/components/icons/IconExpand.vue.d.ts +1 -1
- package/dist/runtime/components/icons/IconMinus.d.vue.ts +1 -1
- package/dist/runtime/components/icons/IconMinus.vue.d.ts +1 -1
- package/dist/runtime/components/icons/IconPlus.d.vue.ts +1 -1
- package/dist/runtime/components/icons/IconPlus.vue.d.ts +1 -1
- package/dist/runtime/components/icons/iconFullScreen.d.vue.ts +1 -1
- package/dist/runtime/components/icons/iconFullScreen.vue.d.ts +1 -1
- package/dist/runtime/components/icons/iconFullScreenExit.d.vue.ts +1 -1
- package/dist/runtime/components/icons/iconFullScreenExit.vue.d.ts +1 -1
- package/dist/runtime/configuration/module.js +4 -0
- package/dist/runtime/constants.d.ts +2 -2
- package/dist/runtime/constants.js +9 -2
- package/dist/runtime/direct-mermaid-config.js +5 -5
- package/dist/runtime/mermaid-config.js +19 -0
- package/dist/runtime/png-rasterizer-loader.d.ts +3 -0
- package/dist/runtime/png-rasterizer-loader.js +7 -0
- package/dist/types/config.ts +91 -0
- package/dist/types/mermaid.d.ts +78 -0
- package/package.json +16 -14
package/README.md
CHANGED
|
@@ -8,9 +8,13 @@
|
|
|
8
8
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
9
9
|
[![License][license-src]][license-href]
|
|
10
10
|
[![Nuxt][nuxt-src]][nuxt-href]
|
|
11
|
-
[](https://mermaid.js.org/)
|
|
12
12
|
[](https://content.nuxt.com/)
|
|
13
13
|
|
|
14
|
+
> This README covers 4.x, which bundles Mermaid 12. The frozen 3.x line keeps its
|
|
15
|
+
> [3.x contract](./docs/en/DEPENDENCY_AND_MIGRATION_CONTRACT.md); to upgrade, follow
|
|
16
|
+
> [Migration to v4](https://nuxt-content-mermaid.barz.app/migration/v4).
|
|
17
|
+
|
|
14
18
|
**@barzhsieh/nuxt-content-mermaid** turns `mermaid` code blocks in Nuxt
|
|
15
19
|
Content Markdown into responsive, interactive diagrams. It supports lazy
|
|
16
20
|
loading, light and dark themes, toolbar controls, and application-provided
|
|
@@ -38,10 +42,11 @@ Nuxt Content peer dependencies and the Nuxt Content database connector.
|
|
|
38
42
|
- Node.js `>=22.19.0`
|
|
39
43
|
- Nuxt `^4.1.0`
|
|
40
44
|
- Nuxt Content `>=3.5.0 <4.0.0`
|
|
45
|
+
- ES2024 browsers; Safari / iOS / iPadOS `17.4+`
|
|
41
46
|
|
|
42
|
-
For dependency ownership, the
|
|
47
|
+
For dependency ownership, the v4 migration boundary, and rendering
|
|
43
48
|
guarantees, see the
|
|
44
|
-
[Dependency and Migration Contract](./docs/en/
|
|
49
|
+
[4.x Dependency and Migration Contract](./docs/en/DEPENDENCY_AND_MIGRATION_CONTRACT_V4.md).
|
|
45
50
|
|
|
46
51
|
## Quick start
|
|
47
52
|
|
|
@@ -79,6 +84,7 @@ For database connector choices and a complete first-project walkthrough, follow
|
|
|
79
84
|
- [Configuration](https://nuxt-content-mermaid.barz.app/configuration)
|
|
80
85
|
- [Troubleshooting](https://nuxt-content-mermaid.barz.app/troubleshooting)
|
|
81
86
|
- [Migration to v3](https://nuxt-content-mermaid.barz.app/migration/v3)
|
|
87
|
+
- [Migration to v4](https://nuxt-content-mermaid.barz.app/migration/v4)
|
|
82
88
|
|
|
83
89
|
## Support and contribution
|
|
84
90
|
|
package/README.zh-TW.md
CHANGED
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
9
9
|
[![License][license-src]][license-href]
|
|
10
10
|
[![Nuxt][nuxt-src]][nuxt-href]
|
|
11
|
-
[](https://mermaid.js.org/)
|
|
12
12
|
[](https://content.nuxt.com/)
|
|
13
13
|
|
|
14
|
+
> 本文件說明綁定 Mermaid 12 的 4.x。已凍結的 3.x 仍適用 [3.x 契約](./docs/ch/DEPENDENCY_AND_MIGRATION_CONTRACT.md);升級請參閱[升級至 v4](https://nuxt-content-mermaid.barz.app/zh/migration/v4)。
|
|
15
|
+
|
|
14
16
|
**@barzhsieh/nuxt-content-mermaid** 會將 Nuxt Content Markdown 中的
|
|
15
17
|
`mermaid` 程式碼圍欄 (fence) 轉換為響應式、可互動的圖表,並支援延遲載入、深淺色
|
|
16
18
|
主題、工具列控制,以及由應用程式提供的渲染元件。
|
|
@@ -38,9 +40,10 @@ dependencies,以及 Nuxt Content database connector。
|
|
|
38
40
|
- Node.js `>=22.19.0`
|
|
39
41
|
- Nuxt `^4.1.0`
|
|
40
42
|
- Nuxt Content `>=3.5.0 <4.0.0`
|
|
43
|
+
- ES2024 瀏覽器;Safari/iOS/iPadOS `17.4+`
|
|
41
44
|
|
|
42
|
-
相依擁有權、
|
|
43
|
-
[相依與遷移契約](./docs/ch/
|
|
45
|
+
相依擁有權、v4 遷移邊界與渲染保證,請參閱
|
|
46
|
+
[4.x 相依與遷移契約](./docs/ch/DEPENDENCY_AND_MIGRATION_CONTRACT_V4.md)。
|
|
44
47
|
|
|
45
48
|
## 快速開始
|
|
46
49
|
|
|
@@ -77,6 +80,7 @@ Mermaid 已包含在本模組中,不需要另外安裝。資料庫 connector
|
|
|
77
80
|
- [設定](https://nuxt-content-mermaid.barz.app/zh/configuration)
|
|
78
81
|
- [疑難排解](https://nuxt-content-mermaid.barz.app/zh/troubleshooting)
|
|
79
82
|
- [升級至 v3](https://nuxt-content-mermaid.barz.app/zh/migration/v3)
|
|
83
|
+
- [升級至 v4](https://nuxt-content-mermaid.barz.app/zh/migration/v4)
|
|
80
84
|
|
|
81
85
|
## 支持與貢獻
|
|
82
86
|
|
package/dist/module.d.mts
CHANGED
|
@@ -102,6 +102,7 @@ interface RuntimeOptions {
|
|
|
102
102
|
/**
|
|
103
103
|
* Whether to lazy load the diagram when it enters the viewport.
|
|
104
104
|
* Can be a boolean or an object with IntersectionObserver options.
|
|
105
|
+
* The threshold must be between 0 and 1, inclusive.
|
|
105
106
|
* @default true
|
|
106
107
|
*/
|
|
107
108
|
lazy?: boolean | {
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -94,7 +94,9 @@ function extractInlineAttrsBlock(info) {
|
|
|
94
94
|
for (let i = startIndex; i < info.length; i++) {
|
|
95
95
|
const char = info[i];
|
|
96
96
|
if (quote) {
|
|
97
|
-
if (char ===
|
|
97
|
+
if (char === "\\")
|
|
98
|
+
i += 1;
|
|
99
|
+
else if (char === quote)
|
|
98
100
|
quote = null;
|
|
99
101
|
continue;
|
|
100
102
|
}
|
|
@@ -126,7 +128,7 @@ function parseInlineAttrsBlock(raw) {
|
|
|
126
128
|
index += 1;
|
|
127
129
|
const key = raw.slice(keyStart, index).trim();
|
|
128
130
|
if (!key)
|
|
129
|
-
|
|
131
|
+
return null;
|
|
130
132
|
index = skipWhitespace(raw, index);
|
|
131
133
|
let value = true;
|
|
132
134
|
if (index < raw.length && (raw[index] === "=" || raw[index] === ":")) {
|
|
@@ -206,7 +208,9 @@ function readBalancedValue(input, start) {
|
|
|
206
208
|
for (let i = start; i < input.length; i++) {
|
|
207
209
|
const char = input[i];
|
|
208
210
|
if (quote) {
|
|
209
|
-
if (char ===
|
|
211
|
+
if (char === "\\")
|
|
212
|
+
i += 1;
|
|
213
|
+
else if (char === quote)
|
|
210
214
|
quote = null;
|
|
211
215
|
continue;
|
|
212
216
|
}
|
|
@@ -434,7 +438,7 @@ function resolveMarkdownToolbar(layers) {
|
|
|
434
438
|
}
|
|
435
439
|
|
|
436
440
|
const MERMAID_COMPONENT_NAME = "ContentMermaidTransport";
|
|
437
|
-
const
|
|
441
|
+
const PAGE_RENDER_DATA_EXPRESSION = "runtimeData";
|
|
438
442
|
function serializeInlineAttributeRecord(value) {
|
|
439
443
|
return JSON.stringify(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'");
|
|
440
444
|
}
|
|
@@ -484,7 +488,7 @@ function transformMarkdownDiagrams(body) {
|
|
|
484
488
|
};
|
|
485
489
|
const buildComponentTag = (encoded, toolbar) => {
|
|
486
490
|
const attrs = [
|
|
487
|
-
`:page-
|
|
491
|
+
`:page-data="${PAGE_RENDER_DATA_EXPRESSION}"`
|
|
488
492
|
];
|
|
489
493
|
if (toolbar && isNonEmptyRecord(toolbar)) {
|
|
490
494
|
attrs.push(`:toolbar='${serializeInlineAttributeRecord(toolbar)}'`);
|
|
@@ -15,6 +15,7 @@ import { defu } from "defu";
|
|
|
15
15
|
import { materializeMermaidConfigForInvocation, resolveMermaidTheme } from "../mermaid-config";
|
|
16
16
|
import { createMermaidRenderer } from "../mermaid-rendering";
|
|
17
17
|
import { getRuntimeMermaidSnapshot } from "../runtime-snapshot";
|
|
18
|
+
import { createPngRasterizerLoader } from "../png-rasterizer-loader";
|
|
18
19
|
import {
|
|
19
20
|
createSafeStandaloneSvgClone,
|
|
20
21
|
downloadBlob,
|
|
@@ -34,10 +35,7 @@ import IconCollapse from "../components/icons/IconCollapse.vue";
|
|
|
34
35
|
import IconDownload from "../components/icons/IconDownload.vue";
|
|
35
36
|
import MermaidFullscreenPresentation from "../components/MermaidFullscreenPresentation.vue";
|
|
36
37
|
import { DEFAULT_TOOLBAR_LABELS } from "../constants";
|
|
37
|
-
|
|
38
|
-
function loadPngRasterizer() {
|
|
39
|
-
return pngRasterizerModulePromise ??= import("../png-rasterizer");
|
|
40
|
-
}
|
|
38
|
+
const loadPngRasterizer = createPngRasterizerLoader(() => import("../png-rasterizer"));
|
|
41
39
|
const props = defineProps({
|
|
42
40
|
toolbar: { type: Object, required: false },
|
|
43
41
|
code: { type: String, required: false },
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { PageMermaidConfig } from '../../types/config.js';
|
|
2
2
|
import type { MermaidToolbarOptions } from '../../types/mermaid.js';
|
|
3
3
|
type __VLS_Props = {
|
|
4
|
-
|
|
4
|
+
pageData?: {
|
|
5
|
+
config?: PageMermaidConfig | null;
|
|
6
|
+
};
|
|
5
7
|
toolbar?: MermaidToolbarOptions;
|
|
6
8
|
code?: string;
|
|
7
9
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, resolveComponent } from "vue";
|
|
3
3
|
const props = defineProps({
|
|
4
|
-
|
|
4
|
+
pageData: { type: Object, required: false },
|
|
5
5
|
toolbar: { type: Object, required: false },
|
|
6
6
|
code: { type: String, required: false }
|
|
7
7
|
});
|
|
8
|
-
const normalizedPageConfig = computed(
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const normalizedPageConfig = computed(() => {
|
|
9
|
+
const config = props.pageData?.config;
|
|
10
|
+
return config === null ? void 0 : config;
|
|
11
|
+
});
|
|
11
12
|
const MermaidComponent = resolveComponent("Mermaid");
|
|
12
13
|
</script>
|
|
13
14
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { PageMermaidConfig } from '../../types/config.js';
|
|
2
2
|
import type { MermaidToolbarOptions } from '../../types/mermaid.js';
|
|
3
3
|
type __VLS_Props = {
|
|
4
|
-
|
|
4
|
+
pageData?: {
|
|
5
|
+
config?: PageMermaidConfig | null;
|
|
6
|
+
};
|
|
5
7
|
toolbar?: MermaidToolbarOptions;
|
|
6
8
|
code?: string;
|
|
7
9
|
};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
declare const _default: typeof __VLS_export;
|
|
2
2
|
export default _default;
|
|
3
|
+
export type __VLS_LocalComponents = {};
|
|
4
|
+
export type __VLS_GlobalComponents = import("vue").GlobalComponents;
|
|
5
|
+
export type __VLS_LocalDirectives = {};
|
|
6
|
+
export type __VLS_StyleScopedClasses = {} & {
|
|
7
|
+
"ncm-spinner": boolean;
|
|
8
|
+
} & {
|
|
9
|
+
"ncm-spinner__path": boolean;
|
|
10
|
+
};
|
|
3
11
|
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
declare const _default: typeof __VLS_export;
|
|
2
2
|
export default _default;
|
|
3
|
+
export type __VLS_LocalComponents = {};
|
|
4
|
+
export type __VLS_GlobalComponents = import("vue").GlobalComponents;
|
|
5
|
+
export type __VLS_LocalDirectives = {};
|
|
6
|
+
export type __VLS_StyleScopedClasses = {} & {
|
|
7
|
+
"ncm-spinner": boolean;
|
|
8
|
+
} & {
|
|
9
|
+
"ncm-spinner__path": boolean;
|
|
10
|
+
};
|
|
3
11
|
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
size?: number | string;
|
|
3
3
|
};
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
-
size:
|
|
5
|
+
size: string | number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -106,6 +106,10 @@ export function validateRuntimeOptions(value, phase) {
|
|
|
106
106
|
assertPlainObject(lazy, phase);
|
|
107
107
|
assertKnownKeys(lazy, /* @__PURE__ */ new Set(["threshold"]), phase, ["loader", "lazy"]);
|
|
108
108
|
assertNumberProperty(lazy, "threshold", phase, ["loader", "lazy"]);
|
|
109
|
+
const threshold = descriptorValue(lazy, "threshold");
|
|
110
|
+
if (typeof threshold === "number" && (threshold < 0 || threshold > 1)) {
|
|
111
|
+
throwConfigurationIssue(phase, ["loader", "lazy", "threshold"], "INVALID_VALUE", "a number between 0 and 1", "out-of-range-number");
|
|
112
|
+
}
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
115
|
}
|
|
@@ -45,6 +45,6 @@ export declare const DEFAULT_RUNTIME_OPTIONS: {
|
|
|
45
45
|
toolbar: MermaidToolbarOptions;
|
|
46
46
|
};
|
|
47
47
|
export declare const DEFAULT_FRONTMATTER_CONFIG_KEY = "config";
|
|
48
|
-
export declare const
|
|
49
|
-
export declare const
|
|
48
|
+
export declare const MERMAID_12_2_0_REGEXP_PATHS: readonly [readonly ["dompurifyConfig", "ALLOWED_URI_REGEXP"], readonly ["dompurifyConfig", "CUSTOM_ELEMENT_HANDLING", "attributeNameCheck"], readonly ["dompurifyConfig", "CUSTOM_ELEMENT_HANDLING", "tagNameCheck"]];
|
|
49
|
+
export declare const MERMAID_12_2_0_FUNCTION_CAPABILITY_PATHS: readonly [readonly ["sequence", "actorFont"], readonly ["sequence", "messageFont"], readonly ["sequence", "noteFont"], readonly ["c4", "personFont"], readonly ["c4", "external_personFont"], readonly ["c4", "systemFont"], readonly ["c4", "external_systemFont"], readonly ["c4", "system_dbFont"], readonly ["c4", "external_system_dbFont"], readonly ["c4", "system_queueFont"], readonly ["c4", "external_system_queueFont"], readonly ["c4", "containerFont"], readonly ["c4", "external_containerFont"], readonly ["c4", "container_dbFont"], readonly ["c4", "external_container_dbFont"], readonly ["c4", "container_queueFont"], readonly ["c4", "external_container_queueFont"], readonly ["c4", "componentFont"], readonly ["c4", "external_componentFont"], readonly ["c4", "component_dbFont"], readonly ["c4", "external_component_dbFont"], readonly ["c4", "component_queueFont"], readonly ["c4", "external_component_queueFont"], readonly ["c4", "boundaryFont"], readonly ["c4", "messageFont"], readonly ["dompurifyConfig", "ADD_ATTR"], readonly ["dompurifyConfig", "ADD_TAGS"], readonly ["dompurifyConfig", "CUSTOM_ELEMENT_HANDLING", "attributeNameCheck"], readonly ["dompurifyConfig", "CUSTOM_ELEMENT_HANDLING", "tagNameCheck"]];
|
|
50
50
|
export declare const DOMPURIFY_3_4_13_OPAQUE_CAPABILITY_PATHS: readonly [readonly ["dompurifyConfig", "TRUSTED_TYPES_POLICY"]];
|
|
@@ -9,6 +9,13 @@ export const FULLSCREEN_ZOOM_HINT_DURATION_MS = 3e3;
|
|
|
9
9
|
export const DEFAULT_MERMAID_CONFIG = {
|
|
10
10
|
startOnLoad: false,
|
|
11
11
|
theme: "default",
|
|
12
|
+
layout: "dagre",
|
|
13
|
+
look: "classic",
|
|
14
|
+
// Mermaid 12 resolves a top-level layout above each diagram type's own schema
|
|
15
|
+
// default, and mindmap skips cose-bilkent whenever any top-level layout is set,
|
|
16
|
+
// so the types whose 3.x layout was never dagre keep theirs explicitly.
|
|
17
|
+
mindmap: { layout: "cose-bilkent" },
|
|
18
|
+
swimlane: { layout: "swimlane" },
|
|
12
19
|
fontFamily: "Arial, sans-serif, \u5FAE\u8EDF\u6B63\u9ED1\u9AD4",
|
|
13
20
|
securityLevel: "strict"
|
|
14
21
|
};
|
|
@@ -84,12 +91,12 @@ export const DEFAULT_RUNTIME_OPTIONS = {
|
|
|
84
91
|
toolbar: DEFAULT_TOOLBAR_OPTIONS
|
|
85
92
|
};
|
|
86
93
|
export const DEFAULT_FRONTMATTER_CONFIG_KEY = "config";
|
|
87
|
-
export const
|
|
94
|
+
export const MERMAID_12_2_0_REGEXP_PATHS = [
|
|
88
95
|
["dompurifyConfig", "ALLOWED_URI_REGEXP"],
|
|
89
96
|
["dompurifyConfig", "CUSTOM_ELEMENT_HANDLING", "attributeNameCheck"],
|
|
90
97
|
["dompurifyConfig", "CUSTOM_ELEMENT_HANDLING", "tagNameCheck"]
|
|
91
98
|
];
|
|
92
|
-
export const
|
|
99
|
+
export const MERMAID_12_2_0_FUNCTION_CAPABILITY_PATHS = [
|
|
93
100
|
["sequence", "actorFont"],
|
|
94
101
|
["sequence", "messageFont"],
|
|
95
102
|
["sequence", "noteFont"],
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createMermaidComponentConfigurationError } from "./component-configuration-error.js";
|
|
2
2
|
import {
|
|
3
3
|
DOMPURIFY_3_4_13_OPAQUE_CAPABILITY_PATHS,
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
MERMAID_12_2_0_FUNCTION_CAPABILITY_PATHS,
|
|
5
|
+
MERMAID_12_2_0_REGEXP_PATHS
|
|
6
6
|
} from "./constants.js";
|
|
7
7
|
function formatConfigPath(path) {
|
|
8
8
|
return path.reduce(
|
|
@@ -28,7 +28,7 @@ function matchesSupportedPath(path, supportedPaths) {
|
|
|
28
28
|
return supportedPaths.some((supportedPath) => supportedPath.length === path.length && supportedPath.every((segment, index) => path[index] === segment));
|
|
29
29
|
}
|
|
30
30
|
function isFunctionCapability(value, path) {
|
|
31
|
-
return typeof value === "function" && matchesSupportedPath(path,
|
|
31
|
+
return typeof value === "function" && matchesSupportedPath(path, MERMAID_12_2_0_FUNCTION_CAPABILITY_PATHS);
|
|
32
32
|
}
|
|
33
33
|
function isOpaqueObjectCapability(value, path) {
|
|
34
34
|
return value !== null && typeof value === "object" && matchesSupportedPath(path, DOMPURIFY_3_4_13_OPAQUE_CAPABILITY_PATHS);
|
|
@@ -37,12 +37,12 @@ function validateDirectValue(value, path, ancestors) {
|
|
|
37
37
|
if (isFunctionCapability(value, path) || isOpaqueObjectCapability(value, path))
|
|
38
38
|
return;
|
|
39
39
|
if (typeof value === "function")
|
|
40
|
-
invalidDirectConfig(path, "a supported capability at its exact Mermaid
|
|
40
|
+
invalidDirectConfig(path, "a supported capability at its exact Mermaid 12.2.0 or DOMPurify 3.4.13 path");
|
|
41
41
|
if (typeof value === "symbol" || typeof value === "bigint")
|
|
42
42
|
invalidDirectConfig(path, "structural data");
|
|
43
43
|
if (value === null || typeof value !== "object") return;
|
|
44
44
|
if (value instanceof RegExp) {
|
|
45
|
-
if (!matchesSupportedPath(path,
|
|
45
|
+
if (!matchesSupportedPath(path, MERMAID_12_2_0_REGEXP_PATHS))
|
|
46
46
|
invalidDirectConfig(path, "a RegExp at an exact DOMPurify 3.4.13 RegExp path");
|
|
47
47
|
if (Reflect.ownKeys(value).some((key) => key !== "lastIndex"))
|
|
48
48
|
invalidDirectConfig(path, "a RegExp without custom properties");
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { mergeByPresence } from "./configuration/core.js";
|
|
2
2
|
import { mergeDirectMermaidConfigForInvocation } from "./direct-mermaid-config.js";
|
|
3
|
+
import { MERMAID_LOG_PREFIX, PAGE_MERMAID_CONFIG_PHASE } from "./constants.js";
|
|
4
|
+
const defaultRendererWarnings = import.meta.dev ? /* @__PURE__ */ new Set() : void 0;
|
|
3
5
|
export function resolveMermaidTheme(options) {
|
|
4
6
|
const {
|
|
5
7
|
colorModeValue,
|
|
@@ -51,5 +53,22 @@ export function materializeMermaidConfigForInvocation(options) {
|
|
|
51
53
|
writable: true
|
|
52
54
|
});
|
|
53
55
|
}
|
|
56
|
+
if (import.meta.dev && defaultRendererWarnings) {
|
|
57
|
+
const sourceLabel = options.source.kind === "page" ? PAGE_MERMAID_CONFIG_PHASE.name : "Direct Mermaid Config";
|
|
58
|
+
const sourceConfig = options.source.kind === "runtime-only" ? void 0 : options.source.config;
|
|
59
|
+
const sources = [
|
|
60
|
+
["loader.init", options.runtimeConfig],
|
|
61
|
+
[sourceLabel, sourceConfig]
|
|
62
|
+
];
|
|
63
|
+
for (const [source, config] of sources) {
|
|
64
|
+
for (const diagram of ["flowchart", "class", "state"]) {
|
|
65
|
+
const diagramConfig = config?.[diagram];
|
|
66
|
+
const key = `${source}.${diagram}.defaultRenderer`;
|
|
67
|
+
if (!diagramConfig || !Object.hasOwn(diagramConfig, "defaultRenderer") || defaultRendererWarnings.has(key)) continue;
|
|
68
|
+
defaultRendererWarnings.add(key);
|
|
69
|
+
console.warn(`${MERMAID_LOG_PREFIX} ${key} is ignored by Mermaid 12. Set layout: 'dagre' (previously 'dagre-wrapper') or layout: 'elk' inside ${diagram} to keep the per-type scope, or at top level for every supporting diagram type.`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
54
73
|
return sourceWorkingCopy;
|
|
55
74
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { MermaidConfig } from 'mermaid'
|
|
2
|
+
import type { ExpandOptions } from '../runtime/types/expand'
|
|
3
|
+
import type { MermaidToolbarOptions } from './mermaid'
|
|
4
|
+
|
|
5
|
+
export type JsonPrimitive = string | number | boolean | null
|
|
6
|
+
export type JsonValue = JsonPrimitive | JsonObject | JsonValue[]
|
|
7
|
+
export type JsonObject = { [key: string]: JsonValue }
|
|
8
|
+
|
|
9
|
+
type IsAny<T> = 0 extends (1 & T) ? true : false
|
|
10
|
+
|
|
11
|
+
type RuntimeDataMember<T> = IsAny<T> extends true
|
|
12
|
+
? never
|
|
13
|
+
: T extends JsonPrimitive
|
|
14
|
+
? T
|
|
15
|
+
: T extends (...args: never[]) => unknown
|
|
16
|
+
? never
|
|
17
|
+
: T extends readonly (infer Item)[]
|
|
18
|
+
? RuntimeDataMember<Item>[]
|
|
19
|
+
: T extends object
|
|
20
|
+
? { [Key in keyof T]: RuntimeDataMember<T[Key]> }
|
|
21
|
+
: never
|
|
22
|
+
|
|
23
|
+
export type RuntimeMermaidConfig = RuntimeDataMember<MermaidConfig> & JsonObject
|
|
24
|
+
export type PageMermaidConfig = RuntimeMermaidConfig
|
|
25
|
+
|
|
26
|
+
export interface RuntimeOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Enable debug mode for detailed logging and error reporting
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
debug?: boolean
|
|
32
|
+
/**
|
|
33
|
+
* Options related to loading mermaid
|
|
34
|
+
*/
|
|
35
|
+
loader?: {
|
|
36
|
+
/**
|
|
37
|
+
* Pure-data configuration passed through Nuxt public runtime config.
|
|
38
|
+
*/
|
|
39
|
+
init?: RuntimeMermaidConfig
|
|
40
|
+
/**
|
|
41
|
+
* Whether to lazy load the diagram when it enters the viewport.
|
|
42
|
+
* Can be a boolean or an object with IntersectionObserver options.
|
|
43
|
+
* The threshold must be between 0 and 1, inclusive.
|
|
44
|
+
* @default true
|
|
45
|
+
*/
|
|
46
|
+
lazy?: boolean | { threshold?: number }
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Options related to theme handling
|
|
50
|
+
*/
|
|
51
|
+
theme?: {
|
|
52
|
+
/** @deprecated No effect; retained for 3.0 compatibility. */
|
|
53
|
+
useColorModeTheme?: boolean
|
|
54
|
+
light?: MermaidConfig['theme']
|
|
55
|
+
dark?: MermaidConfig['theme']
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Names for custom implementation components
|
|
59
|
+
*/
|
|
60
|
+
components?: {
|
|
61
|
+
renderer?: string
|
|
62
|
+
spinner?: string
|
|
63
|
+
error?: string
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Expand configuration. `false` disables expand, `true` uses defaults.
|
|
67
|
+
*/
|
|
68
|
+
expand?: ExpandOptions | boolean
|
|
69
|
+
/**
|
|
70
|
+
* Default toolbar settings for Mermaid component
|
|
71
|
+
*/
|
|
72
|
+
toolbar?: MermaidToolbarOptions
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface ModuleOptions extends RuntimeOptions {
|
|
76
|
+
/**
|
|
77
|
+
* Whether to enable the entire Mermaid process at build time.
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
80
|
+
enabled?: boolean
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface MermaidComponentBaseProps {
|
|
84
|
+
toolbar?: MermaidToolbarOptions
|
|
85
|
+
code?: string
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type MermaidComponentProps = MermaidComponentBaseProps & (
|
|
89
|
+
| { pageConfig?: PageMermaidConfig, config?: never }
|
|
90
|
+
| { pageConfig?: never, config?: MermaidConfig }
|
|
91
|
+
)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { DefineComponent } from 'vue'
|
|
2
|
+
import type { Mermaid } from 'mermaid'
|
|
3
|
+
import type { MermaidComponentProps, ModuleOptions, RuntimeOptions } from './config'
|
|
4
|
+
import type { MermaidThemeMode, SimpleMermaidTheme } from '../runtime/composables/useMermaidTheme'
|
|
5
|
+
|
|
6
|
+
export type MermaidToolbarButtons = {
|
|
7
|
+
copy?: boolean
|
|
8
|
+
fullscreen?: boolean
|
|
9
|
+
expand?: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type MermaidToolbarLabels = {
|
|
13
|
+
copy?: string
|
|
14
|
+
copied?: string
|
|
15
|
+
copyFailed?: string
|
|
16
|
+
expand?: string
|
|
17
|
+
collapse?: string
|
|
18
|
+
minimize?: string
|
|
19
|
+
enterFullscreen?: string
|
|
20
|
+
exitFullscreen?: string
|
|
21
|
+
zoomIn?: string
|
|
22
|
+
zoomOut?: string
|
|
23
|
+
resetZoom?: string
|
|
24
|
+
download?: string
|
|
25
|
+
downloadSvg?: string
|
|
26
|
+
downloadPng?: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type MermaidToolbarOptions = {
|
|
30
|
+
title?: string
|
|
31
|
+
fontSize?: string | number
|
|
32
|
+
fullscreenToolbarScale?: number
|
|
33
|
+
buttons?: MermaidToolbarButtons
|
|
34
|
+
labels?: MermaidToolbarLabels
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare module '#app' {
|
|
38
|
+
interface NuxtApp {
|
|
39
|
+
$mermaid: () => Promise<Mermaid>
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
declare module 'vue' {
|
|
43
|
+
interface ComponentCustomProperties {
|
|
44
|
+
$mermaid: () => Promise<Mermaid>
|
|
45
|
+
}
|
|
46
|
+
interface GlobalComponents {
|
|
47
|
+
Mermaid: DefineComponent<MermaidComponentProps>
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare module '@nuxt/schema' {
|
|
52
|
+
interface NuxtConfig {
|
|
53
|
+
contentMermaid?: ModuleOptions
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface NuxtOptions {
|
|
57
|
+
contentMermaid?: ModuleOptions
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface PublicRuntimeConfig {
|
|
61
|
+
contentMermaid?: RuntimeOptions
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
declare global {
|
|
66
|
+
interface ImportMeta {
|
|
67
|
+
glob<T = unknown>(
|
|
68
|
+
pattern: string,
|
|
69
|
+
options?: {
|
|
70
|
+
eager?: boolean
|
|
71
|
+
import?: string
|
|
72
|
+
},
|
|
73
|
+
): Record<string, () => Promise<T>>
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type { MermaidThemeMode, SimpleMermaidTheme }
|
|
78
|
+
export {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barzhsieh/nuxt-content-mermaid",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "A Nuxt module designed for integrating Mermaid with `@nuxt/content`. It automatically converts `mermaid` code blocks in Markdown into responsive chart components, and supports lazy loading and dark/light theme switching.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nuxt",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"defu": "^6.1.7",
|
|
53
53
|
"destr": "^2.0.5",
|
|
54
54
|
"html-to-image": "1.11.11",
|
|
55
|
-
"mermaid": "~
|
|
55
|
+
"mermaid": "~12.2.0",
|
|
56
56
|
"yaml": "^2.9.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
@@ -60,22 +60,23 @@
|
|
|
60
60
|
"nuxt": "^4.1.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@nuxt/content": "3.
|
|
64
|
-
"@nuxt/devtools": "3.4.
|
|
63
|
+
"@nuxt/content": "3.16.2",
|
|
64
|
+
"@nuxt/devtools": "3.4.4",
|
|
65
65
|
"@nuxt/eslint-config": "1.17.0",
|
|
66
66
|
"@nuxt/module-builder": "1.0.3",
|
|
67
|
-
"@nuxt/schema": "4.
|
|
68
|
-
"@nuxt/test-utils": "^4.
|
|
67
|
+
"@nuxt/schema": "4.6.2",
|
|
68
|
+
"@nuxt/test-utils": "^4.3.4",
|
|
69
69
|
"@nuxtjs/color-mode": "4.0.1",
|
|
70
|
-
"@nuxtjs/mdc": "^0.23.
|
|
70
|
+
"@nuxtjs/mdc": "^0.23.2",
|
|
71
71
|
"@types/node": "^25.3.0",
|
|
72
72
|
"changelogen": "^0.6.2",
|
|
73
|
-
"eslint": "^10.
|
|
74
|
-
"nuxt": "4.
|
|
75
|
-
"
|
|
73
|
+
"eslint": "^10.13.0",
|
|
74
|
+
"nuxt": "4.6.2",
|
|
75
|
+
"oxc-parser": "^0.143.0",
|
|
76
|
+
"playwright": "^1.64.1",
|
|
76
77
|
"typescript": "~5.9.3",
|
|
77
|
-
"vitest": "^
|
|
78
|
-
"vue-tsc": "^3.3.
|
|
78
|
+
"vitest": "^5.0.5",
|
|
79
|
+
"vue-tsc": "^3.3.13",
|
|
79
80
|
"yaml": "^2.9.0"
|
|
80
81
|
},
|
|
81
82
|
"volta": {
|
|
@@ -85,12 +86,13 @@
|
|
|
85
86
|
"dev": "pnpm dev:prepare && nuxi dev playground",
|
|
86
87
|
"dev:build": "nuxi build playground",
|
|
87
88
|
"dev:prepare": "pnpm nuxt-module-build build --stub && pnpm nuxt-module-build prepare && nuxi prepare playground",
|
|
89
|
+
"audit:published": "node scripts/release-verification/audit-published.mjs",
|
|
88
90
|
"lint": "eslint .",
|
|
89
91
|
"release:prepare:major": "changelogen --release --major --no-commit --no-tag --no-github && pnpm install --lockfile-only --ignore-scripts",
|
|
90
92
|
"release:prepare:minor": "changelogen --release --minor --no-commit --no-tag --no-github && pnpm install --lockfile-only --ignore-scripts",
|
|
91
93
|
"release:prepare:patch": "changelogen --release --patch --no-commit --no-tag --no-github && pnpm install --lockfile-only --ignore-scripts",
|
|
92
|
-
"test": "vitest run",
|
|
93
|
-
"test:package-artifact": "node scripts/release-verification/package-artifact.mjs --profile
|
|
94
|
+
"test": "vitest run --exclude test/packagePrepack.test.ts && vitest run test/packagePrepack.test.ts",
|
|
95
|
+
"test:package-artifact": "node scripts/release-verification/package-artifact.mjs --profile known-latest",
|
|
94
96
|
"test:compatibility-profile": "node scripts/release-verification/package-artifact.mjs",
|
|
95
97
|
"test:package-contract": "pnpm prepack && vue-tsc -p test/release-verification/consumer-template/type-contracts/tsconfig.json --noEmit",
|
|
96
98
|
"test:watch": "vitest watch",
|