@docmd/ui 0.5.1 → 0.5.3
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/assets/css/docmd-main.css +529 -139
- package/assets/js/docmd-main.js +8 -6
- package/package.json +1 -1
- package/templates/layout.ejs +178 -157
- package/templates/navigation.ejs +73 -90
- package/templates/no-style.ejs +160 -135
- package/templates/partials/menubar.ejs +129 -0
- package/templates/partials/theme-init.js +14 -12
package/templates/no-style.ejs
CHANGED
|
@@ -8,195 +8,220 @@
|
|
|
8
8
|
|
|
9
9
|
<!DOCTYPE html>
|
|
10
10
|
<html lang="en">
|
|
11
|
+
|
|
11
12
|
<head>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<% if (frontmatter.components?.meta !== false) { %>
|
|
13
|
+
<meta charset="UTF-8">
|
|
14
|
+
<meta name="generator" content="docmd v0.5.x">
|
|
15
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
var root = "<%= relativePathToRoot %>";
|
|
19
|
+
if (root && !root.endsWith('/')) root += '/';
|
|
20
|
+
if (root === '') root = './';
|
|
21
|
+
window.DOCMD_ROOT = root;
|
|
22
|
+
window.DOCMD_APPEARANCE = "<%= appearance %>";
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<!-- 2. META & TITLE -->
|
|
26
|
+
<% if (frontmatter.components?.meta !==false) { %>
|
|
27
27
|
<%- metaTagsHtml || '' %>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
<title>
|
|
29
|
+
<%= pageTitle %>
|
|
30
|
+
<% if (frontmatter.components?.siteTitle !==false) { %> : <%= siteTitle %>
|
|
31
|
+
<% } %>
|
|
32
|
+
</title>
|
|
33
|
+
<% if (description && !(metaTagsHtml && metaTagsHtml.includes('name="description"'))) { %>
|
|
34
|
+
<meta name="description" content="<%= description %>">
|
|
35
|
+
<% } %>
|
|
36
|
+
<% } %>
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
<!-- 3. FAVICON -->
|
|
39
|
+
<% if (frontmatter.components?.favicon !== false) { %>
|
|
36
40
|
<%- faviconLinkHtml || '' %>
|
|
37
|
-
|
|
41
|
+
<% } %>
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
<!-- 4. CORE CSS -->
|
|
44
|
+
<% if (frontmatter.components?.css !== false) { %>
|
|
41
45
|
<link rel="stylesheet" href="<%= relativePathToRoot %>assets/css/docmd-main.css?v=<%= buildHash %>">
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
href="<%= relativePathToRoot %>assets/css/docmd-highlight-dark.css?v=<%= buildHash %>"
|
|
54
|
-
id="hljs-dark"
|
|
55
|
-
<%= isDarkDefault ? '' : 'disabled' %>>
|
|
56
|
-
<% } %>
|
|
47
|
+
<!-- 5. HIGHLIGHT CSS (Toggle Strategy) -->
|
|
48
|
+
<% if (frontmatter.components?.highlight !== false) {
|
|
49
|
+
const isDarkDefault = defaultMode === ' dark'; %>
|
|
50
|
+
<link rel="stylesheet"
|
|
51
|
+
href="<%= relativePathToRoot %>assets/css/docmd-highlight-light.css?v=<%= buildHash %>"
|
|
52
|
+
id="hljs-light" <%=isDarkDefault ? 'disabled' : '' %>>
|
|
53
|
+
|
|
54
|
+
<link rel="stylesheet"
|
|
55
|
+
href="<%= relativePathToRoot %>assets/css/docmd-highlight-dark.css?v=<%= buildHash %>"
|
|
56
|
+
id="hljs-dark" <%=isDarkDefault ? '' : 'disabled' %>>
|
|
57
57
|
<% } %>
|
|
58
|
+
<% } %>
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
<!-- 6. PLUGINS & THEMES (Overrides Core) -->
|
|
61
|
+
<% if (frontmatter.components?.pluginHeadScripts !==false) { %>
|
|
61
62
|
<%- pluginHeadScriptsHtml || '' %>
|
|
62
|
-
|
|
63
|
+
<% } %>
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
<!-- 7. THEME CSS (Legacy/Specific overrides) -->
|
|
66
|
+
<% if (frontmatter.components?.theme !==false) { %>
|
|
66
67
|
<%- themeCssLinkHtml || '' %>
|
|
67
|
-
|
|
68
|
+
<% } %>
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
<% customCssFiles.forEach(cssFile
|
|
72
|
-
|
|
70
|
+
<!-- 8. CUSTOM CSS (Overrides Everything) -->
|
|
71
|
+
<% if (frontmatter.components?.customCss !==false && customCssFiles && customCssFiles.length> 0) { %>
|
|
72
|
+
<% customCssFiles.forEach(cssFile=> { %>
|
|
73
|
+
<link rel="stylesheet"
|
|
74
|
+
href="<%= relativePathToRoot %><%- cssFile.startsWith('/') ? cssFile.substring(1) : cssFile %>?v=<%= buildHash %>">
|
|
73
75
|
<% }); %>
|
|
74
|
-
|
|
76
|
+
<% } %>
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
<!-- 9. PLUGIN STYLES (If separate) -->
|
|
79
|
+
<% if (frontmatter.components?.pluginStyles !==false) { %>
|
|
78
80
|
<%- pluginStylesHtml || '' %>
|
|
79
|
-
|
|
81
|
+
<% } %>
|
|
80
82
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
<!-- 10. THEME INIT (Must be last to apply correct mode immediately) -->
|
|
84
|
+
<% if (frontmatter.components?.themeMode !==false) { %>
|
|
83
85
|
<%- themeInitScript %>
|
|
84
|
-
|
|
86
|
+
<% } %>
|
|
85
87
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
<!-- 11. USER CUSTOM HEAD -->
|
|
89
|
+
<% if (frontmatter.customHead) { %>
|
|
88
90
|
<%- frontmatter.customHead %>
|
|
89
|
-
|
|
91
|
+
<% } %>
|
|
90
92
|
</head>
|
|
91
|
-
<body<% if (frontmatter.components?.theme !==
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
<body<% if (frontmatter.components?.theme !==false) { %> data-theme="<%= defaultMode %>"<% } %>
|
|
94
|
+
<% if (frontmatter.bodyClass) { %> class="<%= frontmatter.bodyClass %>"<% } %> data-copy-code-enabled="<%=
|
|
95
|
+
config.copyCode===true %>">
|
|
96
|
+
<% if (frontmatter.components?.layout===true || frontmatter.components?.layout==='full' ) { %>
|
|
97
|
+
<div class="main-content-wrapper">
|
|
98
|
+
<% if (frontmatter.components?.header !==false) { %>
|
|
99
|
+
<header class="page-header">
|
|
100
|
+
<% if (frontmatter.components?.pageTitle !==false) { %>
|
|
101
|
+
<h1>
|
|
102
|
+
<%= pageTitle %>
|
|
103
|
+
</h1>
|
|
98
104
|
<% } %>
|
|
99
|
-
|
|
105
|
+
</header>
|
|
100
106
|
<% } %>
|
|
101
107
|
<main class="content-area">
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
<div class="content-layout">
|
|
109
|
+
<div class="main-content"><%- content %></div>
|
|
110
|
+
<% if (frontmatter.components?.toc !==false && headings && headings.length> 0) { %>
|
|
111
|
+
<div class="toc-sidebar">
|
|
112
|
+
<%- include('toc', { content, headings, navigationHtml, isActivePage }) %>
|
|
113
|
+
</div>
|
|
114
|
+
<% } %>
|
|
115
|
+
</div>
|
|
110
116
|
</main>
|
|
111
|
-
<% if (frontmatter.components?.footer !==
|
|
112
|
-
|
|
117
|
+
<% if (frontmatter.components?.footer !==false) { %>
|
|
118
|
+
<footer class="page-footer">
|
|
113
119
|
<div class="footer-content">
|
|
114
|
-
|
|
115
|
-
|
|
120
|
+
<div class="user-footer"><%- footerHtml || '' %></div>
|
|
121
|
+
<% if (frontmatter.components?.branding !==false) { %>
|
|
116
122
|
<div class="branding-footer">
|
|
117
|
-
|
|
123
|
+
Build with <svg xmlns="http://www.w3.org/2000/svg"
|
|
124
|
+
width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
|
|
125
|
+
stroke-linecap="round" stroke-linejoin="round">
|
|
126
|
+
<path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z">
|
|
127
|
+
</path>
|
|
128
|
+
<path d="M12 5 9.04 7.96a2.17 2.17 0 0 0 0 3.08c.82.82 2.13.85 3 .07l2.07-1.9a2.82 2.82 0 0 1 3.79 0l2.96 2.66">
|
|
129
|
+
</path>
|
|
130
|
+
<path d="m18 15-2-2"></path>
|
|
131
|
+
<path d="m15 18-2-2"></path>
|
|
132
|
+
</svg> <a href="https://docmd.io" target="_blank" rel="noopener">docmd.</a>
|
|
118
133
|
</div>
|
|
119
|
-
|
|
134
|
+
<% } %>
|
|
120
135
|
</div>
|
|
121
|
-
|
|
136
|
+
</footer>
|
|
122
137
|
<% } %>
|
|
123
|
-
|
|
124
|
-
<% } else if (frontmatter.components?.sidebar
|
|
125
|
-
|
|
126
|
-
<% if (frontmatter.components?.logo !==
|
|
127
|
-
|
|
138
|
+
</div>
|
|
139
|
+
<% } else if (frontmatter.components?.sidebar===true) { %>
|
|
140
|
+
<aside class="sidebar">
|
|
141
|
+
<% if (frontmatter.components?.logo !==false && logo && logo.light && logo.dark) { %>
|
|
142
|
+
<div class="sidebar-header">
|
|
128
143
|
<a href="<%= logo.href || (relativePathToRoot + 'index.html') %>" class="logo-link">
|
|
129
|
-
|
|
130
|
-
|
|
144
|
+
<img src="<%= relativePathToRoot %><%- logo.light.startsWith('/') ? logo.light.substring(1) : logo.light %>"
|
|
145
|
+
alt="<%= logo.alt || siteTitle %>" class="logo-light" <% if (logo.height) { %>style="height: <%= logo.height %>;"<% } %>>
|
|
146
|
+
<img src="<%= relativePathToRoot %><%- logo.dark.startsWith('/') ? logo.dark.substring(1) : logo.dark %>"
|
|
147
|
+
alt="<%= logo.alt || siteTitle %>" class="logo-dark" <% if (logo.height) { %>style="height: <%= logo.height %>;"<% } %>>
|
|
131
148
|
</a>
|
|
132
|
-
|
|
149
|
+
</div>
|
|
133
150
|
<% } %>
|
|
134
|
-
<% if (frontmatter.components?.navigation !==
|
|
135
|
-
|
|
151
|
+
<% if (frontmatter.components?.navigation !==false) { %>
|
|
152
|
+
<%- navigationHtml %>
|
|
136
153
|
<% } %>
|
|
137
|
-
<% if (frontmatter.components?.themeToggle !==
|
|
138
|
-
|
|
154
|
+
<% if (frontmatter.components?.themeToggle !==false && theme && theme.enableModeToggle) { %>
|
|
155
|
+
<button id="theme-toggle-button" aria-label="Toggle theme" class="theme-toggle-button">
|
|
139
156
|
<%- renderIcon('sun', { class: 'icon-sun' }) %> <%- renderIcon('moon', { class: 'icon-moon' }) %>
|
|
140
|
-
|
|
157
|
+
</button>
|
|
141
158
|
<% } %>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
<% if (frontmatter.components?.header !==
|
|
145
|
-
|
|
146
|
-
<% if (frontmatter.components?.pageTitle !==
|
|
147
|
-
|
|
159
|
+
</aside>
|
|
160
|
+
<div class="main-content-wrapper">
|
|
161
|
+
<% if (frontmatter.components?.header !==false) { %>
|
|
162
|
+
<header class="page-header">
|
|
163
|
+
<% if (frontmatter.components?.pageTitle !==false) { %>
|
|
164
|
+
<h1>
|
|
165
|
+
<%= pageTitle %>
|
|
166
|
+
</h1>
|
|
148
167
|
<% } %>
|
|
149
|
-
|
|
168
|
+
</header>
|
|
150
169
|
<% } %>
|
|
151
170
|
<main class="content-area">
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
171
|
+
<div class="content-layout">
|
|
172
|
+
<div class="main-content"><%- content %></div>
|
|
173
|
+
<% if (frontmatter.components?.toc !==false && headings && headings.length> 0) { %>
|
|
174
|
+
<div class="toc-sidebar">
|
|
175
|
+
<%- include('toc', { content, headings, navigationHtml, isActivePage }) %>
|
|
176
|
+
</div>
|
|
177
|
+
<% } %>
|
|
178
|
+
</div>
|
|
160
179
|
</main>
|
|
161
|
-
<% if (frontmatter.components?.footer !==
|
|
162
|
-
|
|
180
|
+
<% if (frontmatter.components?.footer !==false) { %>
|
|
181
|
+
<footer class="page-footer">
|
|
163
182
|
<div class="footer-content">
|
|
164
|
-
|
|
165
|
-
|
|
183
|
+
<div class="user-footer"><%- footerHtml || '' %></div>
|
|
184
|
+
<% if (frontmatter.components?.branding !==false) { %>
|
|
166
185
|
<div class="branding-footer">
|
|
167
|
-
|
|
186
|
+
Build with <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
187
|
+
<path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"></path>
|
|
188
|
+
<path d="M12 5 9.04 7.96a2.17 2.17 0 0 0 0 3.08c.82.82 2.13.85 3 .07l2.07-1.9a2.82 2.82 0 0 1 3.79 0l2.96 2.66"></path>
|
|
189
|
+
<path d="m18 15-2-2"></path>
|
|
190
|
+
<path d="m15 18-2-2"></path>
|
|
191
|
+
</svg> <a href="https://docmd.io" target="_blank" rel="noopener">docmd.</a>
|
|
168
192
|
</div>
|
|
169
|
-
|
|
193
|
+
<% } %>
|
|
170
194
|
</div>
|
|
171
|
-
|
|
195
|
+
</footer>
|
|
172
196
|
<% } %>
|
|
173
|
-
|
|
197
|
+
</div>
|
|
174
198
|
<% } else { %>
|
|
175
|
-
|
|
199
|
+
<%- content %>
|
|
176
200
|
<% } %>
|
|
177
201
|
|
|
178
|
-
<% if (frontmatter.components?.scripts
|
|
179
|
-
|
|
202
|
+
<% if (frontmatter.components?.scripts===true) { %>
|
|
203
|
+
<% if (frontmatter.components?.mainScripts===true) { %>
|
|
180
204
|
<script>window.DOCMD_ROOT = "<%= relativePathToRoot %>";</script>
|
|
181
205
|
<script src="<%= relativePathToRoot %>assets/js/docmd-main.js"></script>
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
206
|
+
<% } %>
|
|
207
|
+
|
|
208
|
+
<% if (frontmatter.components?.lightbox===true && frontmatter.components?.mainScripts===true) { %>
|
|
185
209
|
<script src="<%= relativePathToRoot %>assets/js/docmd-image-lightbox.js"></script>
|
|
186
|
-
|
|
210
|
+
<% } %>
|
|
187
211
|
|
|
188
|
-
|
|
189
|
-
<% customJsFiles.forEach(jsFile
|
|
190
|
-
|
|
212
|
+
<% if (frontmatter.components?.customJs===true && customJsFiles && customJsFiles.length> 0) { %>
|
|
213
|
+
<% customJsFiles.forEach(jsFile=> { %>
|
|
214
|
+
<script src="<%= relativePathToRoot %><%- jsFile.startsWith('/') ? jsFile.substring(1) : jsFile %>"></script>
|
|
191
215
|
<% }); %>
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
216
|
+
<% } %>
|
|
217
|
+
|
|
218
|
+
<% if (frontmatter.components?.scripts !==false) { %>
|
|
219
|
+
<%- pluginBodyScriptsHtml || '' %>
|
|
220
|
+
<% } %>
|
|
197
221
|
<% } %>
|
|
222
|
+
|
|
198
223
|
<% if (frontmatter.customScripts) { %>
|
|
199
|
-
|
|
224
|
+
<%- frontmatter.customScripts %>
|
|
200
225
|
<% } %>
|
|
201
|
-
</body>
|
|
226
|
+
</body>
|
|
202
227
|
</html>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<%# ---------------------------------------------------------------
|
|
2
|
+
# docmd : the minimalist, zero-config documentation generator.
|
|
3
|
+
# @website https://docmd.io
|
|
4
|
+
# [docmd-source] - Please do not remove this header.
|
|
5
|
+
# ---------------------------------------------------------------
|
|
6
|
+
%>
|
|
7
|
+
|
|
8
|
+
<% function menubarHref(item) { if (!item.url) return '#' ; if (item.external || item.url.startsWith('http')) return
|
|
9
|
+
item.url; let clean=item.url.replace(/^\//, '' ); return relativePathToRoot + clean; } function menubarTarget(item)
|
|
10
|
+
{ return (item.external || (item.url && item.url.startsWith('http'))) ? ' target="_blank" rel="noopener noreferrer"'
|
|
11
|
+
: '' ; } %>
|
|
12
|
+
|
|
13
|
+
<div class="docmd-menubar">
|
|
14
|
+
<div class="menubar-inner">
|
|
15
|
+
<div class="menubar-left">
|
|
16
|
+
<% if (menubarConfig.left && menubarConfig.left.length> 0) { %>
|
|
17
|
+
<% menubarConfig.left.forEach(item=> { %>
|
|
18
|
+
<% if (item.type==='title' ) { %>
|
|
19
|
+
<a href="<%= menubarHref(item) %>" class="menubar-brand" <%- menubarTarget(item) %>>
|
|
20
|
+
<% if (item.icon) { %>
|
|
21
|
+
<%- renderIcon(item.icon, { class: 'menubar-icon' }) %>
|
|
22
|
+
<% } %>
|
|
23
|
+
<% if (item.text) { %>
|
|
24
|
+
<span class="menubar-brand-text">
|
|
25
|
+
<%= item.text %>
|
|
26
|
+
</span>
|
|
27
|
+
<% } %>
|
|
28
|
+
</a>
|
|
29
|
+
<% } else if (item.type==='dropdown' ) { %>
|
|
30
|
+
<div class="menubar-dropdown">
|
|
31
|
+
<button class="menubar-dropdown-toggle" type="button" aria-expanded="false">
|
|
32
|
+
<% if (item.icon) { %>
|
|
33
|
+
<%- renderIcon(item.icon, { class: 'menubar-icon' }) %>
|
|
34
|
+
<% } %>
|
|
35
|
+
<span>
|
|
36
|
+
<%= item.text %>
|
|
37
|
+
</span>
|
|
38
|
+
<%- renderIcon('chevron-down', { class: 'menubar-chevron' }) %>
|
|
39
|
+
</button>
|
|
40
|
+
<ul class="menubar-dropdown-menu">
|
|
41
|
+
<% if (item.items && item.items.length> 0) { %>
|
|
42
|
+
<% item.items.forEach(sub=> { %>
|
|
43
|
+
<li>
|
|
44
|
+
<a href="<%= menubarHref(sub) %>" <%- menubarTarget(sub) %>>
|
|
45
|
+
<% if (sub.icon) { %>
|
|
46
|
+
<%- renderIcon(sub.icon, { class: 'menubar-icon' }) %>
|
|
47
|
+
<% } %>
|
|
48
|
+
<%= sub.text %>
|
|
49
|
+
<% if (sub.external || (sub.url && sub.url.startsWith('http'))) { %>
|
|
50
|
+
<%- renderIcon('external-link', { class: 'menubar-ext-icon' }) %>
|
|
51
|
+
<% } %>
|
|
52
|
+
</a>
|
|
53
|
+
</li>
|
|
54
|
+
<% }) %>
|
|
55
|
+
<% } %>
|
|
56
|
+
</ul>
|
|
57
|
+
</div>
|
|
58
|
+
<% } else { %>
|
|
59
|
+
<a href="<%= menubarHref(item) %>" class="menubar-link" <%- menubarTarget(item) %>>
|
|
60
|
+
<% if (item.icon) { %>
|
|
61
|
+
<%- renderIcon(item.icon, { class: 'menubar-icon' }) %>
|
|
62
|
+
<% } %>
|
|
63
|
+
<span>
|
|
64
|
+
<%= item.text %>
|
|
65
|
+
</span>
|
|
66
|
+
<% if (item.external || (item.url && item.url.startsWith('http'))) { %>
|
|
67
|
+
<%- renderIcon('external-link', { class: 'menubar-ext-icon' }) %>
|
|
68
|
+
<% } %>
|
|
69
|
+
</a>
|
|
70
|
+
<% } %>
|
|
71
|
+
<% }) %>
|
|
72
|
+
</div>
|
|
73
|
+
<% } %>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="menubar-right">
|
|
76
|
+
<% if (menubarConfig.right && menubarConfig.right.length> 0) { %>
|
|
77
|
+
<% menubarConfig.right.forEach(item=> { %>
|
|
78
|
+
<% if (item.type==='dropdown' ) { %>
|
|
79
|
+
<div class="menubar-dropdown">
|
|
80
|
+
<button class="menubar-dropdown-toggle" type="button" aria-expanded="false">
|
|
81
|
+
<% if (item.icon) { %>
|
|
82
|
+
<%- renderIcon(item.icon, { class: 'menubar-icon' }) %>
|
|
83
|
+
<% } %>
|
|
84
|
+
<span>
|
|
85
|
+
<%= item.text %>
|
|
86
|
+
</span>
|
|
87
|
+
<%- renderIcon('chevron-down', { class: 'menubar-chevron' }) %>
|
|
88
|
+
</button>
|
|
89
|
+
<ul class="menubar-dropdown-menu menubar-dropdown-right">
|
|
90
|
+
<% if (item.items && item.items.length> 0) { %>
|
|
91
|
+
<% item.items.forEach(sub=> { %>
|
|
92
|
+
<li>
|
|
93
|
+
<a href="<%= menubarHref(sub) %>" <%- menubarTarget(sub) %>>
|
|
94
|
+
<% if (sub.icon) { %>
|
|
95
|
+
<%- renderIcon(sub.icon, { class: 'menubar-icon' }) %>
|
|
96
|
+
<% } %>
|
|
97
|
+
<%= sub.text %>
|
|
98
|
+
<% if (sub.external || (sub.url && sub.url.startsWith('http'))) { %>
|
|
99
|
+
<%- renderIcon('external-link', { class: 'menubar-ext-icon' }) %>
|
|
100
|
+
<% } %>
|
|
101
|
+
</a>
|
|
102
|
+
</li>
|
|
103
|
+
<% }) %>
|
|
104
|
+
<% } %>
|
|
105
|
+
</ul>
|
|
106
|
+
</div>
|
|
107
|
+
<% } else { %>
|
|
108
|
+
<a href="<%= menubarHref(item) %>" class="menubar-link" <%- menubarTarget(item) %>>
|
|
109
|
+
<% if (item.icon) { %>
|
|
110
|
+
<%- renderIcon(item.icon, { class: 'menubar-icon' }) %>
|
|
111
|
+
<% } %>
|
|
112
|
+
<span>
|
|
113
|
+
<%= item.text %>
|
|
114
|
+
</span>
|
|
115
|
+
<% if (item.external || (item.url && item.url.startsWith('http'))) { %>
|
|
116
|
+
<%- renderIcon('external-link', { class: 'menubar-ext-icon' }) %>
|
|
117
|
+
<% } %>
|
|
118
|
+
</a>
|
|
119
|
+
<% } %>
|
|
120
|
+
<% }) %>
|
|
121
|
+
<% } %>
|
|
122
|
+
<% if (optionsMenu && optionsMenu.position==='menubar' ) { %>
|
|
123
|
+
<div class="menubar-options">
|
|
124
|
+
<%- include('options-menu', { optionsMenu }) %>
|
|
125
|
+
</div>
|
|
126
|
+
<% } %>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
@@ -12,35 +12,37 @@
|
|
|
12
12
|
* --------------------------------------------------------------------
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
(function() {
|
|
15
|
+
(function () {
|
|
16
16
|
try {
|
|
17
17
|
// 1. Determine Theme
|
|
18
18
|
var localValue = localStorage.getItem('docmd-theme');
|
|
19
|
-
var configValue = window.DOCMD_DEFAULT_MODE || 'light';
|
|
19
|
+
var configValue = window.DOCMD_DEFAULT_MODE || 'light';
|
|
20
20
|
var theme = localValue ? localValue : configValue;
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
if (theme === 'system') {
|
|
23
23
|
theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// 2. Apply to Root
|
|
27
27
|
document.documentElement.setAttribute('data-theme', theme);
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
// 3. Highlight.js Toggle Strategy
|
|
30
30
|
var lightLink = document.getElementById('hljs-light');
|
|
31
31
|
var darkLink = document.getElementById('hljs-dark');
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
if (lightLink && darkLink) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
if (theme === 'dark') {
|
|
35
|
+
lightLink.disabled = true;
|
|
36
|
+
darkLink.disabled = false;
|
|
37
|
+
} else {
|
|
38
|
+
lightLink.disabled = false;
|
|
39
|
+
darkLink.disabled = true;
|
|
40
|
+
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
document.documentElement.style.visibility = "visible";
|
|
43
44
|
} catch (e) {
|
|
45
|
+
document.documentElement.style.visibility = "visible";
|
|
44
46
|
console.error('Theme init failed', e);
|
|
45
47
|
}
|
|
46
48
|
})();
|