@barzhsieh/nuxt-content-mermaid 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -711,6 +711,7 @@ const { cursorVariables } = useMermaidCursors(iconSize, expandEnabled);
|
|
|
711
711
|
class="mermaid-wrapper"
|
|
712
712
|
:class="{
|
|
713
713
|
'ncm-is-loading': isLoading && !hasRenderedOnce,
|
|
714
|
+
'ncm-is-error': hasError && !isLoading && !hasRenderedOnce,
|
|
714
715
|
'ncm-expand-hidden': isExpandActive,
|
|
715
716
|
'ncm-expand-clickable': expandEnabled && allowOpenDiagramClick && !isFullscreen,
|
|
716
717
|
'ncm-fullscreen-zoom': isFullscreen
|
|
@@ -774,5 +775,5 @@ const { cursorVariables } = useMermaidCursors(iconSize, expandEnabled);
|
|
|
774
775
|
</template>
|
|
775
776
|
|
|
776
777
|
<style scoped>
|
|
777
|
-
.mermaid-block{border:var(--ncm-border);border-radius:4px;flex-direction:column;margin:1rem 0;overflow:hidden;--ncm-toolbar-height:calc(var(--ncm-icon-size, 17px) + 20px)}.mermaid-block,.mermaid-toolbar{background-color:var(--ncm-code-bg);display:flex}.mermaid-toolbar{align-items:center;border-bottom:var(--ncm-border-bottom);border-top-left-radius:4px;border-top-right-radius:4px;justify-content:space-between;padding:.375rem .375rem .375rem .75rem;z-index:20}.mermaid-title{color:var(--ncm-text-muted);font-weight:500;letter-spacing:0;line-height:1.25;max-width:80%;overflow:hidden;padding:4px 0;text-overflow:ellipsis;white-space:nowrap}:fullscreen .mermaid-title{max-width:80%}.mermaid-actions{display:flex;gap:0;justify-self:flex-end}.ncm-download{display:flex;position:relative}.ncm-download-disclosure{background:var(--ncm-code-bg);border:var(--ncm-border);border-radius:4px;box-shadow:0 4px 12px rgba(0,0,0,.15);display:flex;flex-direction:column;min-width:-moz-max-content;min-width:max-content;padding:4px;position:absolute;right:0;top:calc(100% + 4px);z-index:10}.ncm-download-choice{align-items:center;background:transparent;border:none;border-radius:3px;color:var(--ncm-text);cursor:pointer;display:flex;font:inherit;gap:6px;padding:6px 8px;white-space:nowrap}.ncm-download-choice:focus-visible,.ncm-download-choice:hover{background:var(--ncm-code-bg-hover)}.ncm-download-choice:disabled{cursor:not-allowed;opacity:.6}.ncm-download-spinner{animation:ncm-download-spin .8s linear infinite;border:2px solid;border-radius:50%;border-right:2px solid transparent;height:12px;width:12px}@keyframes ncm-download-spin{to{transform:rotate(1turn)}}.mermaid-btn{align-items:center;background:var(--ncm-code-bg);border:none;border-radius:4px;color:var(--ncm-text-xmuted);cursor:pointer;display:flex;justify-content:center;line-height:1.25;padding:4px;transition:color .2s,background-color .2s}.mermaid-btn:hover{background-color:var(--ncm-code-bg-hover);color:var(--ncm-text)}.mermaid-btn:disabled{color:var(--ncm-text-xmuted);cursor:not-allowed;opacity:.6}.mermaid-wrapper{align-items:center;display:flex;justify-content:center;overflow:auto;padding:1rem;position:relative;--sb-thumb:rgba(0,0,0,.2);--sb-thumb-hover:rgba(0,0,0,.35)}.mermaid-wrapper>div{height:100%;width:100%}.mermaid-wrapper>div>:deep(svg){display:block;margin:0 auto}.mermaid-wrapper
|
|
778
|
+
.mermaid-block{border:var(--ncm-border);border-radius:4px;flex-direction:column;margin:1rem 0;overflow:hidden;--ncm-toolbar-height:calc(var(--ncm-icon-size, 17px) + 20px)}.mermaid-block,.mermaid-toolbar{background-color:var(--ncm-code-bg);display:flex}.mermaid-toolbar{align-items:center;border-bottom:var(--ncm-border-bottom);border-top-left-radius:4px;border-top-right-radius:4px;justify-content:space-between;padding:.375rem .375rem .375rem .75rem;z-index:20}.mermaid-title{color:var(--ncm-text-muted);font-weight:500;letter-spacing:0;line-height:1.25;max-width:80%;overflow:hidden;padding:4px 0;text-overflow:ellipsis;white-space:nowrap}:fullscreen .mermaid-title{max-width:80%}.mermaid-actions{display:flex;gap:0;justify-self:flex-end}.ncm-download{display:flex;position:relative}.ncm-download-disclosure{background:var(--ncm-code-bg);border:var(--ncm-border);border-radius:4px;box-shadow:0 4px 12px rgba(0,0,0,.15);display:flex;flex-direction:column;min-width:-moz-max-content;min-width:max-content;padding:4px;position:absolute;right:0;top:calc(100% + 4px);z-index:10}.ncm-download-choice{align-items:center;background:transparent;border:none;border-radius:3px;color:var(--ncm-text);cursor:pointer;display:flex;font:inherit;gap:6px;padding:6px 8px;white-space:nowrap}.ncm-download-choice:focus-visible,.ncm-download-choice:hover{background:var(--ncm-code-bg-hover)}.ncm-download-choice:disabled{cursor:not-allowed;opacity:.6}.ncm-download-spinner{animation:ncm-download-spin .8s linear infinite;border:2px solid;border-radius:50%;border-right:2px solid transparent;height:12px;width:12px}@keyframes ncm-download-spin{to{transform:rotate(1turn)}}.mermaid-btn{align-items:center;background:var(--ncm-code-bg);border:none;border-radius:4px;color:var(--ncm-text-xmuted);cursor:pointer;display:flex;justify-content:center;line-height:1.25;padding:4px;transition:color .2s,background-color .2s}.mermaid-btn:hover{background-color:var(--ncm-code-bg-hover);color:var(--ncm-text)}.mermaid-btn:disabled{color:var(--ncm-text-xmuted);cursor:not-allowed;opacity:.6}.mermaid-wrapper{align-items:center;display:flex;justify-content:center;overflow:auto;padding:1rem;position:relative;--sb-thumb:rgba(0,0,0,.2);--sb-thumb-hover:rgba(0,0,0,.35)}.mermaid-wrapper>div{height:100%;width:100%}.mermaid-wrapper>div>:deep(svg){display:block;margin:0 auto}.mermaid-wrapper>.mermaid>:deep(code),.mermaid-wrapper>.mermaid>:deep(pre){height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border:0;clip-path:inset(50%);white-space:nowrap}.mermaid:not([data-processed]){color:transparent;min-height:100px}.mermaid-wrapper.ncm-is-error>.mermaid{min-height:0;width:0}:fullscreen .mermaid-wrapper{flex:1;overflow:hidden;touch-action:none}:fullscreen .mermaid-wrapper::-webkit-scrollbar{display:none}:fullscreen .mermaid-wrapper :deep(svg){height:100%!important;max-height:none!important;max-width:none!important;width:100%!important}:global(.dark .mermaid-wrapper){--sb-thumb:hsla(0,0%,100%,.2);--sb-thumb-hover:hsla(0,0%,100%,.35)}.mermaid-wrapper::-webkit-scrollbar{width:14px}.mermaid-wrapper::-webkit-scrollbar-track{background:hsla(0,0%,94%,.08)}:global(.dark .mermaid-wrapper::-webkit-scrollbar-track){background:hsla(0,0%,9%,.08)}.mermaid-wrapper::-webkit-scrollbar-corner{background:transparent}.mermaid-wrapper::-webkit-scrollbar-thumb{background-clip:content-box;background-color:var(--sb-thumb);border:3px solid transparent;border-radius:10px}.mermaid-wrapper::-webkit-scrollbar-thumb:hover{background-color:var(--sb-thumb-hover)}.mermaid-wrapper.ncm-is-loading{align-items:center;display:flex;justify-content:center;min-height:150px}.mermaid-wrapper.ncm-expand-hidden{opacity:0;pointer-events:none}.mermaid-wrapper.ncm-expand-clickable :deep(svg){cursor:var(--ncm-cursor-expand)}.mermaid-error-default{color:#f55;font-family:monospace;padding:1rem;white-space:pre-wrap}
|
|
778
779
|
</style>
|
|
@@ -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
|
|
50
|
-
export declare const
|
|
48
|
+
export declare const MERMAID_REGEXP_CAPABILITY_PATHS: readonly [readonly ["dompurifyConfig", "ALLOWED_URI_REGEXP"], readonly ["dompurifyConfig", "CUSTOM_ELEMENT_HANDLING", "attributeNameCheck"], readonly ["dompurifyConfig", "CUSTOM_ELEMENT_HANDLING", "tagNameCheck"]];
|
|
49
|
+
export declare const MERMAID_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
|
+
export declare const MERMAID_OPAQUE_CAPABILITY_PATHS: readonly [readonly ["dompurifyConfig", "TRUSTED_TYPES_POLICY"]];
|
|
@@ -91,12 +91,12 @@ export const DEFAULT_RUNTIME_OPTIONS = {
|
|
|
91
91
|
toolbar: DEFAULT_TOOLBAR_OPTIONS
|
|
92
92
|
};
|
|
93
93
|
export const DEFAULT_FRONTMATTER_CONFIG_KEY = "config";
|
|
94
|
-
export const
|
|
94
|
+
export const MERMAID_REGEXP_CAPABILITY_PATHS = [
|
|
95
95
|
["dompurifyConfig", "ALLOWED_URI_REGEXP"],
|
|
96
96
|
["dompurifyConfig", "CUSTOM_ELEMENT_HANDLING", "attributeNameCheck"],
|
|
97
97
|
["dompurifyConfig", "CUSTOM_ELEMENT_HANDLING", "tagNameCheck"]
|
|
98
98
|
];
|
|
99
|
-
export const
|
|
99
|
+
export const MERMAID_FUNCTION_CAPABILITY_PATHS = [
|
|
100
100
|
["sequence", "actorFont"],
|
|
101
101
|
["sequence", "messageFont"],
|
|
102
102
|
["sequence", "noteFont"],
|
|
@@ -127,6 +127,6 @@ export const MERMAID_12_2_0_FUNCTION_CAPABILITY_PATHS = [
|
|
|
127
127
|
["dompurifyConfig", "CUSTOM_ELEMENT_HANDLING", "attributeNameCheck"],
|
|
128
128
|
["dompurifyConfig", "CUSTOM_ELEMENT_HANDLING", "tagNameCheck"]
|
|
129
129
|
];
|
|
130
|
-
export const
|
|
130
|
+
export const MERMAID_OPAQUE_CAPABILITY_PATHS = [
|
|
131
131
|
["dompurifyConfig", "TRUSTED_TYPES_POLICY"]
|
|
132
132
|
];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createMermaidComponentConfigurationError } from "./component-configuration-error.js";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
MERMAID_FUNCTION_CAPABILITY_PATHS,
|
|
4
|
+
MERMAID_OPAQUE_CAPABILITY_PATHS,
|
|
5
|
+
MERMAID_REGEXP_CAPABILITY_PATHS
|
|
6
6
|
} from "./constants.js";
|
|
7
7
|
function formatConfigPath(path) {
|
|
8
8
|
return path.reduce(
|
|
@@ -28,10 +28,10 @@ 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_FUNCTION_CAPABILITY_PATHS);
|
|
32
32
|
}
|
|
33
33
|
function isOpaqueObjectCapability(value, path) {
|
|
34
|
-
return value !== null && typeof value === "object" && matchesSupportedPath(path,
|
|
34
|
+
return value !== null && typeof value === "object" && matchesSupportedPath(path, MERMAID_OPAQUE_CAPABILITY_PATHS);
|
|
35
35
|
}
|
|
36
36
|
function validateDirectValue(value, path, ancestors) {
|
|
37
37
|
if (isFunctionCapability(value, path) || isOpaqueObjectCapability(value, path))
|
|
@@ -42,7 +42,7 @@ function validateDirectValue(value, path, ancestors) {
|
|
|
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_REGEXP_CAPABILITY_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");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barzhsieh/nuxt-content-mermaid",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
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",
|