@docmd/template-summer 0.8.6 → 0.8.7

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.
@@ -8,16 +8,6 @@
8
8
  switchers, code-block copy, page copy, banner, cookie consent and
9
9
  search-trigger event delegation):
10
10
 
11
- - Inline topbar search dropdown that re-homes docmd-search.js's
12
- full-screen modal into the topbar, forwarding keyboard nav
13
- (↑↓ Enter Esc) to the hidden plugin input
14
- - TOC scroll-spy with a custom SVG path track (the GitBook-style
15
- "folding line" that follows the active heading's indent level)
16
- - TOC smooth-scroll (offset for the sticky topbar + subnav + pageheader)
17
- - Scroll-to-top button (revealed on scroll)
18
- - Git "last-updated" popover (relative dates + recent commits)
19
- - Relative date rendering for any [data-timestamp] element
20
-
21
11
  Everything is idempotent — per-page wires re-run after every
22
12
  docmd:page-mounted event (fired by docmd-main.js on SPA nav).
23
13
  ========================================================================= */
@@ -269,6 +259,42 @@
269
259
 
270
260
  // -------- Scroll to top button -----------------------------------------
271
261
 
262
+ function wireDrawer() {
263
+ // Hamburger toggle: the button lives in the topbar and carries
264
+ // data-summer-sidebar-toggle (it also has .sidebar-menu-button which
265
+ // the shared docmd-main.js handler picks up for the default
266
+ // template; here we just mirror the open state on <body>).
267
+ document.addEventListener('click', function (e) {
268
+ if (e.target.closest('[data-summer-sidebar-toggle]')) {
269
+ document.body.classList.toggle('summer-sidebar-open');
270
+ }
271
+ });
272
+
273
+ // Close button: the X inside the drawer (data-summer-sidebar-close).
274
+ document.addEventListener('click', function (e) {
275
+ if (e.target.closest('[data-summer-sidebar-close]')) {
276
+ document.body.classList.remove('summer-sidebar-open');
277
+ }
278
+ });
279
+
280
+ // Outside click: the backdrop is a body::after pseudo-element so it
281
+ // can't be a real click target. Close the drawer for any click that
282
+ // is outside the sidebar and not on the toggle button.
283
+ document.addEventListener('click', function (e) {
284
+ if (!document.body.classList.contains('summer-sidebar-open')) return;
285
+ if (e.target.closest('.summer-sidebar')) return;
286
+ if (e.target.closest('[data-summer-sidebar-toggle]')) return;
287
+ document.body.classList.remove('summer-sidebar-open');
288
+ });
289
+
290
+ // Escape key closes the drawer.
291
+ document.addEventListener('keydown', function (e) {
292
+ if (e.key === 'Escape' && document.body.classList.contains('summer-sidebar-open')) {
293
+ document.body.classList.remove('summer-sidebar-open');
294
+ }
295
+ });
296
+ }
297
+
272
298
  function wireScrollToTop() {
273
299
  var btn = $('.summer-totop');
274
300
  if (!btn) return;
@@ -508,18 +534,24 @@
508
534
  // The header already exists with a <span class="docmd-code-block-title">.
509
535
  // We add a lang pill next to it (or replace the header content
510
536
  // with our own titlebar) and re-home the copy button.
537
+ //
538
+ // Copy button location depends on how docmd-main.js wires it:
539
+ // - Parser title + no .code-wrapper sibling → button is appended
540
+ // directly into .docmd-code-block-wrapper
541
+ // - Parser title + .code-wrapper → button is inside .code-wrapper
542
+ // We handle both.
511
543
  $$('.docmd-code-block-wrapper').forEach(function (wrap) {
512
544
  if (wrap.dataset.summerCbWired === '1') return;
513
545
  wrap.dataset.summerCbWired = '1';
514
546
 
515
547
  var header = wrap.querySelector('.docmd-code-block-header');
516
- var inner = wrap.querySelector('.code-wrapper');
517
- var copyBtn = inner && inner.querySelector('.copy-code-button');
518
548
  if (!header) return;
549
+ var inner = wrap.querySelector('.code-wrapper');
550
+ var copyBtn = wrap.querySelector('.copy-code-button');
519
551
 
520
552
  // Read language from the <code class="language-xxx">
521
553
  var lang = '';
522
- var pre = inner ? inner.querySelector('pre') : null;
554
+ var pre = inner ? inner.querySelector('pre') : wrap.querySelector('pre');
523
555
  var code = pre ? pre.querySelector('code') : null;
524
556
  if (code) {
525
557
  var m = code.className.match(/language-([\w-]+)/);
@@ -609,14 +641,23 @@
609
641
 
610
642
  // Build a small file-icon SVG (shared by both codeblock paths above).
611
643
  function makeFileIcon() {
612
- var icon = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
644
+ var SVG_NS = 'http://www.w3.org/2000/svg';
645
+ var icon = document.createElementNS(SVG_NS, 'svg');
613
646
  icon.setAttribute('viewBox', '0 0 24 24');
614
647
  icon.setAttribute('fill', 'none');
615
648
  icon.setAttribute('stroke', 'currentColor');
616
649
  icon.setAttribute('stroke-width', '2');
617
650
  icon.setAttribute('stroke-linecap', 'round');
618
651
  icon.setAttribute('stroke-linejoin', 'round');
619
- icon.innerHTML = '<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/>';
652
+
653
+ var path = document.createElementNS(SVG_NS, 'path');
654
+ path.setAttribute('d', 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z');
655
+ icon.appendChild(path);
656
+
657
+ var polyline = document.createElementNS(SVG_NS, 'polyline');
658
+ polyline.setAttribute('points', '14 2 14 8 20 8');
659
+ icon.appendChild(polyline);
660
+
620
661
  return icon;
621
662
  }
622
663
 
@@ -636,6 +677,7 @@
636
677
  if (document.documentElement.dataset.summerWired !== '1') {
637
678
  // First run: bind document-level listeners + topbar/footer wires
638
679
  document.documentElement.dataset.summerWired = '1';
680
+ wireDrawer();
639
681
  wireScrollToTop();
640
682
  wireHeaderSearch();
641
683
  }
@@ -153,4 +153,4 @@
153
153
  </div>
154
154
  </main>
155
155
  </body>
156
- </html>
156
+ </html>
@@ -2,7 +2,7 @@
2
2
  ============================================================================
3
3
  @docmd/template-summer — layout.ejs
4
4
 
5
- A complete, GitBook-inspired documentation layout. Built to feel like its
5
+ A complete, modern documentation layout. Built to feel like its
6
6
  own product — not a recolor of the default template. The page is structured
7
7
  as five vertically-stacked, sticky-aware bands:
8
8
 
@@ -138,7 +138,6 @@
138
138
  <% } %>
139
139
  </div>
140
140
 
141
- <%# CENTER — Inline Search Input (GitBook-style dropdown) %>
142
141
  <div class="summer-topbar__center">
143
142
  <div class="summer-search-container">
144
143
  <svg class="summer-search__icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@docmd/template-summer",
3
- "version": "0.8.6",
4
- "description": "Summer template for docmd 0.8.7+",
3
+ "version": "0.8.7",
4
+ "description": "Summer template for docmd. A bright, hopeful, summer-feel layout with a top search bar and halo accents.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -15,7 +15,7 @@
15
15
  "dist"
16
16
  ],
17
17
  "devDependencies": {
18
- "@types/node": "^25.9.3",
18
+ "@types/node": "^24.13.2",
19
19
  "esbuild": "^0.28.1",
20
20
  "typescript": "^5.9.3",
21
21
  "@docmd/api": "0.8.7"
@@ -23,16 +23,28 @@
23
23
  "docmd": {
24
24
  "kind": "template",
25
25
  "displayName": "Summer",
26
- "tagline": "A bright, hopeful, summer-feel layout with a top search bar.",
26
+ "tagline": "A bright, hopeful, summer-feel layout with a top search bar and halo accents.",
27
27
  "preview": "assets/css/summer.css"
28
28
  },
29
29
  "keywords": [
30
30
  "docmd",
31
+ "documentation",
31
32
  "docmd-template",
32
33
  "template",
33
34
  "summer",
34
- "documentation",
35
- "theme"
35
+ "theme",
36
+ "markdown",
37
+ "minimalist",
38
+ "zero-config",
39
+ "site-generator",
40
+ "static-site-generator",
41
+ "typescript",
42
+ "javascript",
43
+ "nodejs",
44
+ "browser",
45
+ "website",
46
+ "generator",
47
+ "docs"
36
48
  ],
37
49
  "engines": {
38
50
  "node": ">=18"
@@ -43,16 +55,13 @@
43
55
  },
44
56
  "repository": {
45
57
  "type": "git",
46
- "url": "https://github.com/docmd-io/docmd",
47
- "directory": "packages/templates/summer"
58
+ "url": "git+https://github.com/docmd-io/docmd.git"
48
59
  },
49
60
  "bugs": {
50
61
  "url": "https://github.com/docmd-io/docmd/issues"
51
62
  },
52
63
  "homepage": "https://docmd.io",
53
- "funding": {
54
- "github": "https://github.com/sponsors/mgks"
55
- },
64
+ "funding": "https://github.com/sponsors/mgks",
56
65
  "license": "MIT",
57
66
  "scripts": {
58
67
  "build": "tsc && node scripts/copy-assets.mjs",