@knowcode/doc-builder 1.3.8 → 1.3.9
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 +22 -0
- package/assets/css/style.css +2 -2
- package/assets/js/main.js +35 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,28 @@ 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.9] - 2025-07-19
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Fixed tooltip JavaScript positioning implementation
|
|
12
|
+
- Removed invalid getComputedStyle call on pseudo-elements
|
|
13
|
+
- Added mouseleave handler to clean up CSS variables
|
|
14
|
+
- Fixed tooltip arrow positioning with proper transform
|
|
15
|
+
- Added event listener cleanup to prevent duplicates
|
|
16
|
+
- Added console logging for tooltip debugging
|
|
17
|
+
|
|
18
|
+
### Improved
|
|
19
|
+
- Tooltips now properly use fixed positioning as per lessons learned
|
|
20
|
+
- Added MutationObserver to handle dynamically updated navigation
|
|
21
|
+
- Better event handling with proper cleanup on element replacement
|
|
22
|
+
- More robust tooltip initialization that works with dynamic content
|
|
23
|
+
|
|
24
|
+
### Technical Details
|
|
25
|
+
- JavaScript now correctly sets `--tooltip-left` and `--tooltip-top` CSS variables
|
|
26
|
+
- Fixed positioning allows tooltips to escape overflow containers
|
|
27
|
+
- Event listeners are properly cleaned up to prevent memory leaks
|
|
28
|
+
- Console logging helps debug tooltip initialization issues
|
|
29
|
+
|
|
8
30
|
## [1.3.8] - 2025-07-19
|
|
9
31
|
|
|
10
32
|
### Fixed
|
package/assets/css/style.css
CHANGED
|
@@ -1848,9 +1848,9 @@ section + section {
|
|
|
1848
1848
|
[data-tooltip]::before {
|
|
1849
1849
|
content: '';
|
|
1850
1850
|
position: fixed;
|
|
1851
|
-
left:
|
|
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
|
@@ -1333,15 +1333,32 @@ function generateBreadcrumbs() {
|
|
|
1333
1333
|
// Initialize tooltip positioning for navigation items
|
|
1334
1334
|
function initTooltips() {
|
|
1335
1335
|
const tooltipElements = document.querySelectorAll('[data-tooltip]');
|
|
1336
|
+
console.log(`Initializing tooltips for ${tooltipElements.length} elements`);
|
|
1336
1337
|
|
|
1337
1338
|
tooltipElements.forEach(element => {
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1339
|
+
// Remove any existing listeners to prevent duplicates
|
|
1340
|
+
const newElement = element.cloneNode(true);
|
|
1341
|
+
element.parentNode.replaceChild(newElement, element);
|
|
1342
|
+
|
|
1343
|
+
newElement.addEventListener('mouseenter', function(e) {
|
|
1344
|
+
const rect = newElement.getBoundingClientRect();
|
|
1345
|
+
const tooltipText = newElement.getAttribute('data-tooltip');
|
|
1341
1346
|
|
|
1342
1347
|
// Position the tooltip using CSS variables
|
|
1343
|
-
|
|
1344
|
-
|
|
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
|
+
});
|
|
1357
|
+
|
|
1358
|
+
// Clean up on mouse leave
|
|
1359
|
+
newElement.addEventListener('mouseleave', function(e) {
|
|
1360
|
+
newElement.style.removeProperty('--tooltip-left');
|
|
1361
|
+
newElement.style.removeProperty('--tooltip-top');
|
|
1345
1362
|
});
|
|
1346
1363
|
});
|
|
1347
1364
|
}
|
|
@@ -1356,4 +1373,17 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
1356
1373
|
addPDFExportButton();
|
|
1357
1374
|
generateBreadcrumbs();
|
|
1358
1375
|
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
|
+
}
|
|
1359
1389
|
});
|