@knowcode/doc-builder 1.1.10 → 1.1.12

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,45 @@ 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.1.12] - 2025-07-19
9
+
10
+ ### Fixed (MAJOR)
11
+ - **Fixed sidebar layout** - Navigation now appears as fixed-width left sidebar instead of above content
12
+ - Added proper flexbox container layout with fixed sidebar positioning
13
+ - Navigation is now 280px fixed width on left side with proper scrolling
14
+ - Content area properly offset to account for sidebar width
15
+
16
+ ### Added
17
+ - Container flexbox layout for proper sidebar + content structure
18
+ - Fixed navigation positioning with proper z-index and boundaries
19
+ - Mobile responsive layout - sidebar becomes horizontal bar on mobile
20
+ - Proper scrolling for both navigation and content areas
21
+
22
+ ### Visual Changes
23
+ - Navigation background set to secondary color with right border
24
+ - Content area now takes full remaining width after sidebar
25
+ - Proper spacing and padding for both sidebar and content
26
+ - Mobile layout stacks navigation above content
27
+
28
+ ## [1.1.11] - 2025-07-19
29
+
30
+ ### Fixed (MAJOR)
31
+ - **Fixed navigation completely** - HTML structure now matches JavaScript expectations
32
+ - Replaced incompatible nav-folder structure with nav-section/nav-content structure
33
+ - Navigation now works for both flat and nested folder structures
34
+ - Fixed JavaScript initialization issues with navigation elements
35
+
36
+ ### Changed
37
+ - Complete rewrite of navigation HTML generation to match main.js expectations
38
+ - Updated CSS to work with new nav-section structure
39
+ - Removed conflicting nav-flat classes in favor of universal nav-item approach
40
+
41
+ ### Technical Details
42
+ - HTML now generates `.nav-section` + `.nav-content` instead of `.nav-folder` + `.nav-folder-content`
43
+ - JavaScript can now find and initialize navigation elements properly
44
+ - Collapsible navigation works for nested structures
45
+ - Simple navigation works for flat file structures
46
+
8
47
  ## [1.1.10] - 2025-07-19
9
48
 
10
49
  ### Fixed
@@ -372,13 +372,26 @@ pre code {
372
372
  font-size: var(--text-sm);
373
373
  }
374
374
 
375
+ /* Layout Container */
376
+ .container {
377
+ display: flex;
378
+ height: calc(100vh - var(--header-height));
379
+ overflow: hidden;
380
+ }
381
+
375
382
  /* Navigation */
376
383
  .navigation {
384
+ width: var(--sidebar-width);
385
+ background: var(--color-bg-secondary);
386
+ border-right: 1px solid var(--color-border-default);
377
387
  padding: var(--space-2);
378
388
  overflow-y: auto;
379
389
  overflow-x: visible;
380
- flex: 1;
381
- position: relative;
390
+ position: fixed;
391
+ top: var(--header-height);
392
+ left: 0;
393
+ height: calc(100vh - var(--header-height));
394
+ z-index: 100;
382
395
 
383
396
  /* Scrollbar styling */
384
397
  scrollbar-width: thin;
@@ -531,9 +544,10 @@ pre code {
531
544
  .content {
532
545
  flex: 1;
533
546
  margin-left: var(--sidebar-width);
534
- padding: var(--space-10) var(--space-8);
535
- max-width: calc(65rem + var(--space-8) * 2);
536
- transition: margin-left var(--duration-normal);
547
+ padding: var(--space-6) var(--space-8);
548
+ overflow-y: auto;
549
+ height: calc(100vh - var(--header-height));
550
+ max-width: none;
537
551
  }
538
552
 
539
553
  .content-inner {
@@ -1459,18 +1473,35 @@ tr:hover {
1459
1473
  [data-tooltip]::after {
1460
1474
  display: none;
1461
1475
  }
1476
+
1477
+ .container {
1478
+ flex-direction: column;
1479
+ }
1480
+
1481
+ .navigation {
1482
+ position: relative;
1483
+ width: 100%;
1484
+ height: auto;
1485
+ max-height: 200px;
1486
+ top: 0;
1487
+ left: 0;
1488
+ border-right: none;
1489
+ border-bottom: 1px solid var(--color-border-default);
1490
+ }
1491
+
1492
+ .content {
1493
+ margin-left: 0;
1494
+ height: auto;
1495
+ min-height: calc(100vh - var(--header-height) - 200px);
1496
+ }
1462
1497
  }
1463
1498
 
1464
- /* Navigation: Flat vs Collapsible */
1465
- .nav-flat .nav-folder-toggle {
1466
- display: none;
1467
- }
1468
-
1469
- .nav-flat li {
1499
+ /* Navigation: Enhanced for all structures */
1500
+ .nav-item {
1470
1501
  margin-bottom: var(--space-0-5);
1471
1502
  }
1472
1503
 
1473
- .nav-flat .nav-link {
1504
+ .nav-item .nav-link {
1474
1505
  display: block;
1475
1506
  padding: var(--space-1) var(--space-2);
1476
1507
  color: var(--color-text-secondary);
@@ -1481,13 +1512,32 @@ tr:hover {
1481
1512
  font-weight: 400;
1482
1513
  }
1483
1514
 
1484
- .nav-flat .nav-link:hover {
1515
+ .nav-item .nav-link:hover {
1485
1516
  background: var(--color-bg-hover);
1486
1517
  color: var(--color-text-primary);
1487
1518
  }
1488
1519
 
1489
- .nav-flat .nav-link.active {
1520
+ .nav-item.active .nav-link,
1521
+ .nav-item .nav-link.active {
1490
1522
  background: var(--color-accent-blue-bg);
1491
1523
  color: var(--color-accent-blue);
1492
1524
  font-weight: 500;
1525
+ }
1526
+
1527
+ /* Ensure nav sections are visible and functional */
1528
+ .nav-section {
1529
+ margin-bottom: var(--space-1);
1530
+ }
1531
+
1532
+ .nav-content {
1533
+ padding-left: var(--space-2);
1534
+ }
1535
+
1536
+ /* Override any conflicting styles */
1537
+ .navigation .nav-section .nav-content {
1538
+ display: block;
1539
+ }
1540
+
1541
+ .navigation .nav-section .nav-content.collapsed {
1542
+ display: none;
1493
1543
  }
@@ -166,60 +166,71 @@ function buildNavigationStructure(files, currentFile) {
166
166
  current.files.push(file);
167
167
  });
168
168
 
169
- // Generate HTML
170
- const generateNavHTML = (node, path = '') => {
171
- let html = '';
169
+ // Check if this is a flat structure
170
+ const hasFolders = Object.keys(tree.folders).length > 0;
171
+
172
+ if (!hasFolders) {
173
+ // Generate simple flat navigation that matches what JavaScript expects
174
+ let html = '<div class="nav-section">';
175
+ html += '<div class="nav-content">';
172
176
 
173
- // Add files
174
- node.files.forEach(file => {
177
+ tree.files.forEach(file => {
175
178
  const isActive = file.urlPath === currentFile;
176
179
  const href = file.urlPath.replace(/\\/g, '/');
177
- html += `<li class="${isActive ? 'active' : ''}">
180
+ html += `<div class="nav-item ${isActive ? 'active' : ''}">
178
181
  <a href="${href}" class="nav-link ${isActive ? 'active' : ''}">
179
- ${file.displayName}
182
+ <span class="nav-text">${file.displayName}</span>
180
183
  </a>
181
- </li>`;
184
+ </div>`;
182
185
  });
183
186
 
184
- // Add folders
185
- Object.entries(node.folders).forEach(([folderName, folderNode]) => {
186
- const folderPath = path ? `${path}/${folderName}` : folderName;
187
- const hasActiveChild = checkActiveChild(folderNode, currentFile);
187
+ html += '</div></div>';
188
+ return html;
189
+ } else {
190
+ // Generate collapsible navigation for folder structures
191
+ const generateNavHTML = (node, path = '', level = 0) => {
192
+ let html = '';
188
193
 
189
- html += `<li class="nav-folder ${hasActiveChild ? 'active' : ''}">
190
- <button class="nav-folder-toggle ${hasActiveChild ? 'active' : ''}" data-folder="${folderPath}">
191
- <i class="fas fa-chevron-${hasActiveChild ? 'down' : 'right'}"></i>
192
- ${folderName}
193
- </button>
194
- <ul class="nav-folder-content ${hasActiveChild ? 'active' : ''}">
195
- ${generateNavHTML(folderNode, folderPath)}
196
- </ul>
197
- </li>`;
198
- });
194
+ // Add folders as sections
195
+ Object.entries(node.folders).forEach(([folderName, folderNode]) => {
196
+ const folderPath = path ? `${path}/${folderName}` : folderName;
197
+ const hasActiveChild = checkActiveChild(folderNode, currentFile);
198
+ const sectionId = `nav-${folderPath.replace(/\//g, '-')}`;
199
+
200
+ html += `<div class="nav-section ${hasActiveChild ? 'expanded' : ''}">
201
+ <div class="nav-title collapsible ${hasActiveChild ? 'expanded' : ''}" data-target="${sectionId}">
202
+ <i class="fas fa-chevron-${hasActiveChild ? 'down' : 'right'}"></i>
203
+ <span class="nav-text">${folderName}</span>
204
+ </div>
205
+ <div class="nav-content ${hasActiveChild ? '' : 'collapsed'}" id="${sectionId}">
206
+ ${generateNavHTML(folderNode, folderPath, level + 1)}
207
+ </div>
208
+ </div>`;
209
+ });
210
+
211
+ // Add files
212
+ node.files.forEach(file => {
213
+ const isActive = file.urlPath === currentFile;
214
+ const href = file.urlPath.replace(/\\/g, '/');
215
+ html += `<div class="nav-item ${isActive ? 'active' : ''}">
216
+ <a href="${href}" class="nav-link ${isActive ? 'active' : ''}">
217
+ <span class="nav-text">${file.displayName}</span>
218
+ </a>
219
+ </div>`;
220
+ });
221
+
222
+ return html;
223
+ };
199
224
 
200
- return html;
201
- };
202
-
203
- const checkActiveChild = (node, currentFile) => {
204
- // Check files
205
- if (node.files.some(f => f.urlPath === currentFile)) return true;
225
+ const checkActiveChild = (node, currentFile) => {
226
+ // Check files
227
+ if (node.files.some(f => f.urlPath === currentFile)) return true;
228
+
229
+ // Check folders recursively
230
+ return Object.values(node.folders).some(folder => checkActiveChild(folder, currentFile));
231
+ };
206
232
 
207
- // Check folders recursively
208
- return Object.values(node.folders).some(folder => checkActiveChild(folder, currentFile));
209
- };
210
-
211
- const navHTML = generateNavHTML(tree);
212
-
213
- // If there are no folders (flat structure), wrap in a simple nav-list
214
- // If there are folders, use collapsible navigation
215
- const hasFolders = Object.keys(tree.folders).length > 0;
216
-
217
- if (!hasFolders) {
218
- // Simple flat navigation
219
- return `<ul class="nav-list nav-flat">${navHTML}</ul>`;
220
- } else {
221
- // Collapsible navigation with folders
222
- return `<ul class="nav-list nav-collapsible">${navHTML}</ul>`;
233
+ return generateNavHTML(tree);
223
234
  }
224
235
  }
225
236
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowcode/doc-builder",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {