@knowcode/doc-builder 1.3.9 → 1.3.11

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.3.11] - 2025-07-19
9
+
10
+ ### Fixed
11
+ - **CRITICAL FIX**: Removed duplicate CSS file loading that was causing style conflicts
12
+ - Now only loads `notion-style.css` matching the original working build
13
+ - This fixes both tooltip functionality and spacing issues
14
+
15
+ ### Root Cause
16
+ - The npm package was loading both `notion-style.css` AND `style.css`
17
+ - The `style.css` file was overriding proper styles from `notion-style.css`
18
+ - This caused spacing conflicts and broke tooltip positioning
19
+ - The original cybersolstice build only loads `notion-style.css`
20
+
21
+ ### Impact
22
+ - Tooltips now work correctly with proper positioning
23
+ - Navigation spacing matches the original design
24
+ - No more CSS variable conflicts between themes
25
+ - Consistent styling throughout the application
26
+
27
+ ## [1.3.10] - 2025-07-19
28
+
29
+ ### Fixed
30
+ - Reduced excessive top spacing in content area (changed from 40px to 16px)
31
+ - Fixed tooltip implementation with event delegation for better performance
32
+ - Added native `title` attribute as fallback for tooltips
33
+ - Applied spacing fixes to both default and notion themes
34
+
35
+ ### Improved
36
+ - Content now starts closer to the header/breadcrumb area
37
+ - Tooltips use simpler event delegation instead of individual listeners
38
+ - Better tooltip support with both custom CSS tooltips and native browser tooltips
39
+ - Removed unnecessary MutationObserver for cleaner code
40
+
41
+ ### Technical Details
42
+ - Content padding reduced from 40px to var(--space-lg) (16px)
43
+ - Event delegation on navigation container captures all tooltip events
44
+ - Native title attributes ensure tooltips work even if CSS/JS fails
45
+ - More efficient event handling with capture phase listeners
46
+
8
47
  ## [1.3.9] - 2025-07-19
9
48
 
10
49
  ### Fixed
@@ -705,7 +705,7 @@ pre code {
705
705
  .content {
706
706
  flex: 1;
707
707
  margin-left: var(--sidebar-width);
708
- padding: 40px var(--space-8);
708
+ padding: var(--space-4) var(--space-8);
709
709
  overflow-y: auto;
710
710
  background: var(--color-bg-default);
711
711
  transition: margin-left var(--duration-normal);
@@ -1087,7 +1087,7 @@ em, i {
1087
1087
  .content {
1088
1088
  flex: 1;
1089
1089
  margin-left: var(--sidebar-width);
1090
- padding: 40px var(--space-2xl) var(--space-xl);
1090
+ padding: var(--space-lg) var(--space-2xl) var(--space-xl);
1091
1091
  max-width: calc(var(--content-max-width) + var(--space-2xl) * 2);
1092
1092
  transition: margin-left var(--transition-base);
1093
1093
  }
package/assets/js/main.js CHANGED
@@ -1332,35 +1332,33 @@ function generateBreadcrumbs() {
1332
1332
 
1333
1333
  // Initialize tooltip positioning for navigation items
1334
1334
  function initTooltips() {
1335
- const tooltipElements = document.querySelectorAll('[data-tooltip]');
1336
- console.log(`Initializing tooltips for ${tooltipElements.length} elements`);
1335
+ // Use event delegation for better performance and dynamic content support
1336
+ const navigation = document.querySelector('.navigation');
1337
+ if (!navigation) return;
1337
1338
 
1338
- tooltipElements.forEach(element => {
1339
- // Remove any existing listeners to prevent duplicates
1340
- const newElement = element.cloneNode(true);
1341
- element.parentNode.replaceChild(newElement, element);
1339
+ navigation.addEventListener('mouseenter', function(e) {
1340
+ const tooltipElement = e.target.closest('[data-tooltip]');
1341
+ if (!tooltipElement) return;
1342
1342
 
1343
- newElement.addEventListener('mouseenter', function(e) {
1344
- const rect = newElement.getBoundingClientRect();
1345
- const tooltipText = newElement.getAttribute('data-tooltip');
1346
-
1347
- // Position the tooltip using CSS variables
1348
- // Tooltip appears to the right of the element with 10px gap
1349
- const leftPos = rect.right + 10;
1350
- const topPos = rect.top + rect.height / 2;
1351
-
1352
- console.log(`Tooltip positioned at: ${leftPos}, ${topPos} for "${tooltipText}"`);
1353
-
1354
- newElement.style.setProperty('--tooltip-left', `${leftPos}px`);
1355
- newElement.style.setProperty('--tooltip-top', `${topPos}px`);
1356
- });
1343
+ const rect = tooltipElement.getBoundingClientRect();
1344
+ const tooltipText = tooltipElement.getAttribute('data-tooltip');
1357
1345
 
1358
- // Clean up on mouse leave
1359
- newElement.addEventListener('mouseleave', function(e) {
1360
- newElement.style.removeProperty('--tooltip-left');
1361
- newElement.style.removeProperty('--tooltip-top');
1362
- });
1363
- });
1346
+ // Position the tooltip using CSS variables
1347
+ // Tooltip appears to the right of the element with 10px gap
1348
+ const leftPos = rect.right + 10;
1349
+ const topPos = rect.top + rect.height / 2;
1350
+
1351
+ tooltipElement.style.setProperty('--tooltip-left', `${leftPos}px`);
1352
+ tooltipElement.style.setProperty('--tooltip-top', `${topPos}px`);
1353
+ }, true); // Use capture phase
1354
+
1355
+ navigation.addEventListener('mouseleave', function(e) {
1356
+ const tooltipElement = e.target.closest('[data-tooltip]');
1357
+ if (!tooltipElement) return;
1358
+
1359
+ tooltipElement.style.removeProperty('--tooltip-left');
1360
+ tooltipElement.style.removeProperty('--tooltip-top');
1361
+ }, true); // Use capture phase
1364
1362
  }
1365
1363
 
1366
1364
  // Initialize on DOM Load
@@ -1373,17 +1371,4 @@ document.addEventListener('DOMContentLoaded', () => {
1373
1371
  addPDFExportButton();
1374
1372
  generateBreadcrumbs();
1375
1373
  initTooltips();
1376
-
1377
- // Re-initialize tooltips if navigation is dynamically updated
1378
- const navigation = document.querySelector('.navigation');
1379
- if (navigation) {
1380
- const observer = new MutationObserver(() => {
1381
- initTooltips();
1382
- });
1383
-
1384
- observer.observe(navigation, {
1385
- childList: true,
1386
- subtree: true
1387
- });
1388
- }
1389
1374
  });
@@ -83,7 +83,6 @@ function generateHTML(title, content, navigation, currentPath = '', config = {})
83
83
 
84
84
  <!-- Styles -->
85
85
  <link rel="stylesheet" href="/css/notion-style.css">
86
- <link rel="stylesheet" href="/css/style.css">
87
86
 
88
87
  <!-- Favicon -->
89
88
  <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>📚</text></svg>">
@@ -286,7 +285,7 @@ function buildNavigationStructure(files, currentFile) {
286
285
 
287
286
  // Get folder description for tooltip
288
287
  const folderDescription = folderDescriptions[folderName] || '';
289
- const tooltipAttr = folderDescription ? `data-tooltip="${escapeHtml(folderDescription)}"` : '';
288
+ const tooltipAttr = folderDescription ? `data-tooltip="${escapeHtml(folderDescription)}" title="${escapeHtml(folderDescription)}"` : '';
290
289
 
291
290
  // Start all sections collapsed by default (JavaScript will expand sections containing active items)
292
291
  const hasActiveChild = checkActiveChild(folderData, currentFile);
@@ -821,7 +820,6 @@ async function createDefaultIndexPage(outputDir, config, version) {
821
820
  <title>Welcome to ${siteName}</title>
822
821
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
823
822
  <link rel="stylesheet" href="/css/notion-style.css">
824
- <link rel="stylesheet" href="/css/style.css">
825
823
  <style>
826
824
  .welcome-container {
827
825
  max-width: 800px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowcode/doc-builder",
3
- "version": "1.3.9",
3
+ "version": "1.3.11",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {