@knowcode/doc-builder 1.3.5 → 1.3.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,43 @@ All notable changes to @knowcode/doc-builder will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.3.7] - 2025-07-19
9
+
10
+ ### Fixed
11
+ - Fixed content area not collapsing when sidebar is hidden on mobile
12
+ - Content now properly takes full width when sidebar is closed
13
+ - Added !important to margin-left: 0 for mobile breakpoints to ensure proper override
14
+ - Fixed issue where content appeared too far right on mobile devices
15
+
16
+ ### Improved
17
+ - Content area now properly responds to sidebar state on all screen sizes
18
+ - Better use of available screen space on mobile devices
19
+ - Consistent behavior across both default and notion-style themes
20
+
21
+ ## [1.3.6] - 2025-07-19
22
+
23
+ ### Fixed
24
+ - Fixed responsive menu toggle button not being visible on mobile devices
25
+ - Added mobile overlay for sidebar with proper click-to-close functionality
26
+ - Improved sidebar z-index stacking for proper mobile display
27
+ - Added smooth transitions and shadow effects for mobile sidebar
28
+ - Fixed body scroll prevention when mobile menu is open
29
+ - Menu toggle button now shows close icon (X) when menu is open
30
+ - Sidebar properly closes when clicking navigation items on mobile
31
+ - Escape key now properly closes mobile menu and overlay
32
+
33
+ ### Added
34
+ - Semi-transparent overlay background when sidebar is open on mobile
35
+ - Visual feedback for menu toggle button state (hamburger/close icon)
36
+ - Box shadow on mobile sidebar for better depth perception
37
+ - Proper ARIA attributes for accessibility
38
+
39
+ ### Improved
40
+ - Better mobile user experience with standard mobile navigation patterns
41
+ - Consistent behavior across different mobile breakpoints
42
+ - Smoother animations and transitions for mobile menu
43
+ - Applied fixes to both default and notion-style themes
44
+
8
45
  ## [1.3.5] - 2025-07-19
9
46
 
10
47
  ### Fixed
@@ -704,9 +704,11 @@ pre code {
704
704
 
705
705
  .content {
706
706
  flex: 1;
707
+ margin-left: var(--sidebar-width);
707
708
  padding: 40px var(--space-8);
708
709
  overflow-y: auto;
709
710
  background: var(--color-bg-default);
711
+ transition: margin-left var(--duration-normal);
710
712
  }
711
713
 
712
714
  .content-inner {
@@ -987,6 +989,43 @@ tr:hover {
987
989
  cursor: pointer;
988
990
  color: var(--color-text-primary);
989
991
  padding: var(--space-2);
992
+ margin-left: var(--space-2);
993
+ transition: color var(--duration-fast);
994
+ z-index: 1001;
995
+ }
996
+
997
+ .menu-toggle:hover {
998
+ color: var(--color-accent-blue);
999
+ }
1000
+
1001
+ .menu-toggle.active i::before {
1002
+ content: "\f00d"; /* fa-times icon */
1003
+ }
1004
+
1005
+ /* Mobile Sidebar Overlay */
1006
+ .sidebar-overlay {
1007
+ position: fixed;
1008
+ top: 0;
1009
+ left: 0;
1010
+ right: 0;
1011
+ bottom: 0;
1012
+ background: var(--color-bg-overlay);
1013
+ z-index: 998;
1014
+ opacity: 0;
1015
+ visibility: hidden;
1016
+ transition: opacity var(--duration-normal), visibility var(--duration-normal);
1017
+ display: none;
1018
+ }
1019
+
1020
+ @media (max-width: 1024px) {
1021
+ .sidebar-overlay {
1022
+ display: block;
1023
+ }
1024
+ }
1025
+
1026
+ .sidebar-overlay.active {
1027
+ opacity: 1;
1028
+ visibility: visible;
990
1029
  }
991
1030
 
992
1031
  /* Responsive Design */
@@ -994,6 +1033,8 @@ tr:hover {
994
1033
  .sidebar {
995
1034
  transform: translateX(-100%);
996
1035
  transition: transform var(--duration-normal) var(--easing-out);
1036
+ z-index: 999;
1037
+ box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
997
1038
  }
998
1039
 
999
1040
  .sidebar.open {
@@ -1005,8 +1046,9 @@ tr:hover {
1005
1046
  }
1006
1047
 
1007
1048
  .content {
1008
- margin-left: 0;
1049
+ margin-left: 0 !important;
1009
1050
  padding: var(--space-6) var(--space-4);
1051
+ max-width: 100%;
1010
1052
  }
1011
1053
 
1012
1054
  .menu-toggle {
@@ -1646,7 +1688,9 @@ tr:hover {
1646
1688
  }
1647
1689
 
1648
1690
  .content {
1691
+ margin-left: 0 !important;
1649
1692
  padding: var(--space-4);
1693
+ max-width: 100%;
1650
1694
  }
1651
1695
 
1652
1696
  .content-inner {
@@ -1388,15 +1388,22 @@ blockquote {
1388
1388
  @media (max-width: 1024px) {
1389
1389
  .sidebar {
1390
1390
  transform: translateX(-100%);
1391
+ z-index: 999;
1392
+ box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
1391
1393
  }
1392
1394
 
1393
1395
  .sidebar.open {
1394
1396
  transform: translateX(0);
1395
1397
  }
1396
1398
 
1399
+ [data-theme="dark"] .sidebar {
1400
+ box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
1401
+ }
1402
+
1397
1403
  .content {
1398
- margin-left: 0;
1404
+ margin-left: 0 !important;
1399
1405
  padding: var(--space-xl);
1406
+ max-width: 100%;
1400
1407
  }
1401
1408
 
1402
1409
  .search-box {
@@ -1405,6 +1412,12 @@ blockquote {
1405
1412
  }
1406
1413
 
1407
1414
  @media (max-width: 768px) {
1415
+ .content {
1416
+ margin-left: 0 !important;
1417
+ padding: var(--space-md);
1418
+ max-width: 100%;
1419
+ }
1420
+
1408
1421
  h1 {
1409
1422
  font-size: 2rem;
1410
1423
  }
@@ -1493,6 +1506,17 @@ blockquote {
1493
1506
  cursor: pointer;
1494
1507
  color: var(--text-primary);
1495
1508
  padding: var(--space-sm);
1509
+ margin-left: var(--space-sm);
1510
+ transition: color var(--transition-fast);
1511
+ z-index: 1001;
1512
+ }
1513
+
1514
+ .menu-toggle:hover {
1515
+ color: var(--accent);
1516
+ }
1517
+
1518
+ .menu-toggle.active i::before {
1519
+ content: "\f00d"; /* fa-times icon */
1496
1520
  }
1497
1521
 
1498
1522
  @media (max-width: 1024px) {
@@ -1501,6 +1525,32 @@ blockquote {
1501
1525
  }
1502
1526
  }
1503
1527
 
1528
+ /* Mobile Sidebar Overlay */
1529
+ .sidebar-overlay {
1530
+ position: fixed;
1531
+ top: 0;
1532
+ left: 0;
1533
+ right: 0;
1534
+ bottom: 0;
1535
+ background: rgba(0, 0, 0, 0.5);
1536
+ z-index: 998;
1537
+ opacity: 0;
1538
+ visibility: hidden;
1539
+ transition: opacity var(--transition-base), visibility var(--transition-base);
1540
+ display: none;
1541
+ }
1542
+
1543
+ @media (max-width: 1024px) {
1544
+ .sidebar-overlay {
1545
+ display: block;
1546
+ }
1547
+ }
1548
+
1549
+ .sidebar-overlay.active {
1550
+ opacity: 1;
1551
+ visibility: visible;
1552
+ }
1553
+
1504
1554
  /* Search Results Dropdown */
1505
1555
  .search-results {
1506
1556
  position: absolute;
package/assets/js/main.js CHANGED
@@ -511,10 +511,30 @@ function updateThemeIcon(theme) {
511
511
  // Mobile Menu Toggle
512
512
  const menuToggle = document.getElementById('menu-toggle');
513
513
  const sidebar = document.querySelector('.sidebar');
514
+ const sidebarOverlay = document.querySelector('.sidebar-overlay');
514
515
 
515
516
  if (menuToggle) {
516
517
  menuToggle.addEventListener('click', () => {
517
518
  sidebar.classList.toggle('open');
519
+ sidebarOverlay.classList.toggle('active');
520
+ menuToggle.classList.toggle('active');
521
+
522
+ // Prevent body scroll when menu is open
523
+ if (sidebar.classList.contains('open')) {
524
+ document.body.style.overflow = 'hidden';
525
+ } else {
526
+ document.body.style.overflow = '';
527
+ }
528
+ });
529
+ }
530
+
531
+ // Close sidebar when clicking overlay
532
+ if (sidebarOverlay) {
533
+ sidebarOverlay.addEventListener('click', () => {
534
+ sidebar.classList.remove('open');
535
+ sidebarOverlay.classList.remove('active');
536
+ menuToggle.classList.remove('active');
537
+ document.body.style.overflow = '';
518
538
  });
519
539
  }
520
540
 
@@ -522,14 +542,17 @@ if (menuToggle) {
522
542
  // Only close when clicking outside the sidebar or the close button
523
543
  document.addEventListener('click', (e) => {
524
544
  // Check if we're on mobile
525
- if (window.innerWidth <= 768) {
545
+ if (window.innerWidth <= 1024) {
526
546
  const isClickInsideSidebar = sidebar && sidebar.contains(e.target);
527
547
  const isMenuToggle = e.target.closest('#menu-toggle');
528
- const isNavItem = e.target.closest('.nav-item, .nav-title');
548
+ const isOverlay = e.target.closest('.sidebar-overlay');
529
549
 
530
- // Close sidebar only if clicking outside AND not on menu toggle AND not on nav items
531
- if (!isClickInsideSidebar && !isMenuToggle && !isNavItem && sidebar?.classList.contains('open')) {
550
+ // Close sidebar when clicking nav items on mobile
551
+ if (e.target.closest('.nav-item') && sidebar?.classList.contains('open')) {
532
552
  sidebar.classList.remove('open');
553
+ sidebarOverlay?.classList.remove('active');
554
+ menuToggle?.classList.remove('active');
555
+ document.body.style.overflow = '';
533
556
  }
534
557
  }
535
558
  });
@@ -666,6 +689,9 @@ document.addEventListener('keydown', (e) => {
666
689
  // Escape to close mobile menu
667
690
  if (e.key === 'Escape') {
668
691
  sidebar?.classList.remove('open');
692
+ sidebarOverlay?.classList.remove('active');
693
+ menuToggle?.classList.remove('active');
694
+ document.body.style.overflow = '';
669
695
  }
670
696
  });
671
697
 
@@ -141,6 +141,9 @@ function generateHTML(title, content, navigation, currentPath = '', config = {})
141
141
 
142
142
  <!-- Main Content -->
143
143
  <div class="main-wrapper">
144
+ <!-- Sidebar Overlay -->
145
+ <div class="sidebar-overlay"></div>
146
+
144
147
  <!-- Sidebar -->
145
148
  <aside class="sidebar">
146
149
  <div class="sidebar-header">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowcode/doc-builder",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {