-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathembed.html
More file actions
126 lines (119 loc) · 5.59 KB
/
Copy pathembed.html
File metadata and controls
126 lines (119 loc) · 5.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mermaid Diagram — MermZen Embed</title>
<meta name="description" content="Embedded Mermaid diagram rendered by MermZen. Create and share beautiful diagrams instantly.">
<meta name="robots" content="noindex, follow">
<link rel="canonical" href="https://eric.run.place/MermZen/embed.html">
<!-- 字体:国内可达的 npmmirror 镜像(小赖中文手绘);Kalam 拉丁手绘内联 @font-face -->
<link rel="preconnect" href="https://registry.npmmirror.com" crossorigin>
<link rel="dns-prefetch" href="https://registry.npmmirror.com">
<!-- preload 提前触发字体下载,确保 Mermaid 渲染前字体就绪,避免中文文字截断 -->
<link rel="preload" href="https://registry.npmmirror.com/@fontsource/kalam/5.2.8/files/files/kalam-latin-400-normal.woff2" as="font" type="font/woff2" crossorigin>
<link rel="stylesheet" href="https://registry.npmmirror.com/@chinese-fonts/xiaolai/3.0.0/files/dist/Xiaolai/result.css">
<style>
/* font-display: block — 在字体加载期间保留空白位(最多 3s),避免 Mermaid 用降级字体量出错误的文字宽度 */
@font-face { font-family: 'Kalam'; font-style: normal; font-weight: 400; font-display: block; src: url('https://registry.npmmirror.com/@fontsource/kalam/5.2.8/files/files/kalam-latin-400-normal.woff2') format('woff2'); }
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: transparent; overflow: hidden; min-height: 100vh; }
#container { width: 100%; height: 100vh; overflow: hidden; position: relative; }
#diagram { transform-origin: 0 0; cursor: grab; }
#diagram:active { cursor: grabbing; }
#diagram svg { display: block; }
#error { color: #c0392b; font-family: monospace; font-size: 13px; padding: 16px; white-space: pre-wrap; }
/* MermZen 品牌角标 */
#brand {
position: fixed;
right: 8px;
bottom: 8px;
display: inline-flex;
align-items: center;
gap: 4px;
padding: 3px 8px;
font: 600 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
color: #5b6470;
text-decoration: none;
background: rgba(255, 255, 255, 0.72);
border: 1px solid rgba(0, 0, 0, 0.08);
border-radius: 999px;
backdrop-filter: blur(6px);
-webkit-backdrop-filter: blur(6px);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
opacity: 0.55;
transition: opacity 0.18s ease, transform 0.18s ease;
z-index: 10;
user-select: none;
}
#brand:hover { opacity: 1; transform: translateY(-1px); }
#brand svg { width: 12px; height: 12px; }
/* Export mode: hide interactive UI for CLI/automation rendering */
.export-mode #toolbar,
.export-mode #brand { display: none !important; }
/* 缩放工具栏 */
#toolbar {
position: fixed;
left: 8px;
bottom: 8px;
display: flex;
flex-direction: column;
gap: 4px;
z-index: 10;
opacity: 0.55;
transition: opacity 0.18s ease;
}
#toolbar:hover { opacity: 1; }
#toolbar button {
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
cursor: pointer;
color: #3b4252;
background: rgba(255, 255, 255, 0.82);
border: 1px solid rgba(0, 0, 0, 0.08);
border-radius: 8px;
backdrop-filter: blur(6px);
-webkit-backdrop-filter: blur(6px);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
transition: background 0.15s ease, transform 0.1s ease;
}
#toolbar button:hover { background: #ffffff; }
#toolbar button:active { transform: scale(0.92); }
#toolbar svg { width: 16px; height: 16px; }
</style>
</head>
<body>
<div id="container">
<div id="diagram"></div>
</div>
<div id="error" style="display:none"></div>
<div id="toolbar">
<button id="zoom-in" type="button" title="Zoom in" aria-label="Zoom in">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><line x1="11" y1="8" x2="11" y2="14"></line><line x1="8" y1="11" x2="14" y2="11"></line>
</svg>
</button>
<button id="zoom-out" type="button" title="Zoom out" aria-label="Zoom out">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><line x1="8" y1="11" x2="14" y2="11"></line>
</svg>
</button>
<button id="zoom-fit" type="button" title="Fit to view" aria-label="Fit to view">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M15 3h6v6"></path><path d="M9 21H3v-6"></path><path d="M21 3l-7 7"></path><path d="M3 21l7-7"></path>
</svg>
</button>
</div>
<a id="brand" href="https://eric.run.place/MermZen/" target="_blank" rel="noopener" title="Edit this diagram in MermZen">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon>
</svg>
<span>MermZen</span>
</a>
<script type="module" src="/src/embed.ts"></script>
</body>
</html>