@barzhsieh/nuxt-content-mermaid 2.1.0-alpha.1 → 2.1.2

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
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.20.1 || ^4.1.0"
6
6
  },
7
- "version": "2.1.0-alpha.1",
7
+ "version": "2.1.2",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -298,6 +298,7 @@ watch(decodedCode, (newCode) => {
298
298
  <div
299
299
  v-else
300
300
  class="mermaid-wrapper"
301
+ :class="{ 'ncm-is-loading': isLoading && !hasRenderedOnce }"
301
302
  >
302
303
  <div ref="mermaidContainer">
303
304
  <!-- Initially show the slot's <pre><code> for SSR; client-side rendering will replace it with the mermaid SVG -->
@@ -337,5 +338,5 @@ watch(decodedCode, (newCode) => {
337
338
  </template>
338
339
 
339
340
  <style scoped>
340
- .mermaid-wrapper{position:relative;text-align:center}.mermaid-wrapper :deep(code),.mermaid-wrapper :deep(pre){margin:0;max-height:160px;opacity:0;overflow:hidden;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.mermaid-wrapper :deep(svg){display:inline-block;vertical-align:middle}.mermaid-error-default{text-align:center}.mermaid:not([data-processed]){color:transparent;min-height:10px}.mermaid-wrapper :deep(.edgeLabel),.mermaid-wrapper :deep(.label),.mermaid-wrapper :deep(.nodeLabel){overflow:visible!important;white-space:normal!important}.mermaid-wrapper :deep(foreignObject){overflow:visible!important}
341
+ .mermaid-wrapper{--ncm-loading-min-height:160px;position:relative;text-align:center}.mermaid-wrapper.ncm-is-loading{min-height:var(--ncm-loading-min-height,160px)}.mermaid-wrapper :deep(code),.mermaid-wrapper :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-wrapper :deep(svg){display:inline-block;vertical-align:middle}.mermaid-error-default{text-align:center}.mermaid:not([data-processed]){color:transparent;min-height:10px}.mermaid-wrapper :deep(.edgeLabel),.mermaid-wrapper :deep(.label),.mermaid-wrapper :deep(.nodeLabel){overflow:visible!important;white-space:normal!important}.mermaid-wrapper :deep(foreignObject){overflow:visible!important}
341
342
  </style>
@@ -1,15 +1,19 @@
1
1
  <template>
2
2
  <svg
3
- class="spinner"
3
+ class="ncm-spinner"
4
4
  viewBox="0 0 50 50"
5
5
  >
6
6
  <circle
7
- class="path"
7
+ class="ncm-spinner__path"
8
8
  cx="25"
9
9
  cy="25"
10
10
  r="20"
11
11
  fill="none"
12
12
  stroke-width="5"
13
+ stroke="rgb(197, 197, 197)"
14
+ stroke-linecap="round"
15
+ stroke-dasharray="1 150"
16
+ stroke-dashoffset="0"
13
17
  />
14
18
  </svg>
15
19
  </template>
@@ -20,6 +24,6 @@ export default {
20
24
  };
21
25
  </script>
22
26
 
23
- <style>
24
- .spinner{--radius:20px;animation:rotate 2s linear infinite;height:calc(var(--radius)*2);left:50%;margin:calc(var(--radius)*-1) 0 0 calc(var(--radius)*-1);position:absolute;top:50%;width:calc(var(--radius)*2);z-index:2}.spinner .path{animation:dash 1.5s ease-in-out infinite;stroke:#c5c5c5;stroke-linecap:round}@keyframes rotate{to{transform:rotate(1turn)}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}
27
+ <style scoped>
28
+ .ncm-spinner{--radius:20px;animation:rotate 2s linear infinite;height:calc(var(--radius)*2);left:50%;margin:calc(var(--radius)*-1) 0 0 calc(var(--radius)*-1);position:absolute;top:50%;transform-origin:50% 50%;width:calc(var(--radius)*2);z-index:2}.ncm-spinner__path{animation:dash 1.5s ease-in-out infinite}@keyframes rotate{to{transform:rotate(1turn)}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}
25
29
  </style>
@@ -1,17 +1,17 @@
1
1
  import type { MermaidConfig } from 'mermaid';
2
2
  /**
3
- * 簡寫模式主題,用於快速切換配置的 light/dark 主題
4
- * - 'light': 對應 contentMermaid.theme.light 設定
5
- * - 'dark': 對應 contentMermaid.theme.dark 設定
6
- * @see https://mermaid.js.org/ecosystem/integrations.html
3
+ * Switch between configured dark/light themes
4
+ * - 'light': corresponds to contentMermaid.theme.light setting
5
+ * - 'dark': corresponds to contentMermaid.theme.dark setting
7
6
  */
8
7
  export type SimpleMermaidTheme = 'light' | 'dark';
9
8
  /**
10
- * Mermaid 主題類型
11
- * 可以是:
12
- * - 簡寫模式: 'light', 'dark' (對應配置的 light/dark 主題)
13
- * - 官方主題: 'default', 'forest', 'dark', 'neutral', 'base' 等
14
- * - null: 重置為自動模式
9
+ * Mermaid theme type
10
+ * Can be:
11
+ * - Simple mode: 'light', 'dark' (corresponds to configured light/dark theme)
12
+ * - Official themes: 'default', 'forest', 'dark', 'neutral', 'base', etc.
13
+ * @see https://mermaid.js.org/config/schema-docs/config.html?#theme
14
+ * - null: Reset to auto mode
15
15
  */
16
16
  export type MermaidThemeMode = MermaidConfig['theme'] | SimpleMermaidTheme | null;
17
17
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barzhsieh/nuxt-content-mermaid",
3
- "version": "2.1.0-alpha.1",
3
+ "version": "2.1.2",
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",