@knowcode/doc-builder 1.3.8 → 1.3.10

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,48 @@ 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.10] - 2025-07-19
9
+
10
+ ### Fixed
11
+ - Reduced excessive top spacing in content area (changed from 40px to 16px)
12
+ - Fixed tooltip implementation with event delegation for better performance
13
+ - Added native `title` attribute as fallback for tooltips
14
+ - Applied spacing fixes to both default and notion themes
15
+
16
+ ### Improved
17
+ - Content now starts closer to the header/breadcrumb area
18
+ - Tooltips use simpler event delegation instead of individual listeners
19
+ - Better tooltip support with both custom CSS tooltips and native browser tooltips
20
+ - Removed unnecessary MutationObserver for cleaner code
21
+
22
+ ### Technical Details
23
+ - Content padding reduced from 40px to var(--space-lg) (16px)
24
+ - Event delegation on navigation container captures all tooltip events
25
+ - Native title attributes ensure tooltips work even if CSS/JS fails
26
+ - More efficient event handling with capture phase listeners
27
+
28
+ ## [1.3.9] - 2025-07-19
29
+
30
+ ### Fixed
31
+ - Fixed tooltip JavaScript positioning implementation
32
+ - Removed invalid getComputedStyle call on pseudo-elements
33
+ - Added mouseleave handler to clean up CSS variables
34
+ - Fixed tooltip arrow positioning with proper transform
35
+ - Added event listener cleanup to prevent duplicates
36
+ - Added console logging for tooltip debugging
37
+
38
+ ### Improved
39
+ - Tooltips now properly use fixed positioning as per lessons learned
40
+ - Added MutationObserver to handle dynamically updated navigation
41
+ - Better event handling with proper cleanup on element replacement
42
+ - More robust tooltip initialization that works with dynamic content
43
+
44
+ ### Technical Details
45
+ - JavaScript now correctly sets `--tooltip-left` and `--tooltip-top` CSS variables
46
+ - Fixed positioning allows tooltips to escape overflow containers
47
+ - Event listeners are properly cleaned up to prevent memory leaks
48
+ - Console logging helps debug tooltip initialization issues
49
+
8
50
  ## [1.3.8] - 2025-07-19
9
51
 
10
52
  ### 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
  }
@@ -1848,9 +1848,9 @@ section + section {
1848
1848
  [data-tooltip]::before {
1849
1849
  content: '';
1850
1850
  position: fixed;
1851
- left: calc(var(--tooltip-left, 0) - 8px);
1851
+ left: var(--tooltip-left, 0);
1852
1852
  top: var(--tooltip-top, 0);
1853
- transform: translateY(-50%);
1853
+ transform: translateX(-8px) translateY(-50%);
1854
1854
  width: 0;
1855
1855
  height: 0;
1856
1856
  border-style: solid;
package/assets/js/main.js CHANGED
@@ -1332,18 +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]');
1335
+ // Use event delegation for better performance and dynamic content support
1336
+ const navigation = document.querySelector('.navigation');
1337
+ if (!navigation) return;
1336
1338
 
1337
- tooltipElements.forEach(element => {
1338
- element.addEventListener('mouseenter', function(e) {
1339
- const rect = element.getBoundingClientRect();
1340
- const tooltip = window.getComputedStyle(element, '::after');
1341
-
1342
- // Position the tooltip using CSS variables
1343
- element.style.setProperty('--tooltip-left', `${rect.right + 10}px`);
1344
- element.style.setProperty('--tooltip-top', `${rect.top + rect.height / 2}px`);
1345
- });
1346
- });
1339
+ navigation.addEventListener('mouseenter', function(e) {
1340
+ const tooltipElement = e.target.closest('[data-tooltip]');
1341
+ if (!tooltipElement) return;
1342
+
1343
+ const rect = tooltipElement.getBoundingClientRect();
1344
+ const tooltipText = tooltipElement.getAttribute('data-tooltip');
1345
+
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
1347
1362
  }
1348
1363
 
1349
1364
  // Initialize on DOM Load
@@ -286,7 +286,7 @@ function buildNavigationStructure(files, currentFile) {
286
286
 
287
287
  // Get folder description for tooltip
288
288
  const folderDescription = folderDescriptions[folderName] || '';
289
- const tooltipAttr = folderDescription ? `data-tooltip="${escapeHtml(folderDescription)}"` : '';
289
+ const tooltipAttr = folderDescription ? `data-tooltip="${escapeHtml(folderDescription)}" title="${escapeHtml(folderDescription)}"` : '';
290
290
 
291
291
  // Start all sections collapsed by default (JavaScript will expand sections containing active items)
292
292
  const hasActiveChild = checkActiveChild(folderData, currentFile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowcode/doc-builder",
3
- "version": "1.3.8",
3
+ "version": "1.3.10",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {