astro-tractstack 2.0.0-rc.15 → 2.0.0-rc.16
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/package.json
CHANGED
|
@@ -51,26 +51,40 @@ const PanelVisibilityWrapper = ({
|
|
|
51
51
|
const currentWrapper = wrapperRef.current;
|
|
52
52
|
if (!currentWrapper) return;
|
|
53
53
|
|
|
54
|
-
//
|
|
54
|
+
// Skip intersection observer for 'add' panels - they behave differently
|
|
55
|
+
if (panelType === 'add') {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
55
59
|
const observer = new IntersectionObserver(
|
|
56
60
|
(entries) => {
|
|
57
|
-
//
|
|
58
|
-
if (
|
|
59
|
-
|
|
61
|
+
// Add delay to prevent immediate closing during panel activation
|
|
62
|
+
if (isActive) {
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
// Double-check the panel is still active before closing
|
|
65
|
+
const currentActiveMode = nodesCtx.activePaneMode.get();
|
|
66
|
+
const stillActive =
|
|
67
|
+
currentActiveMode.panel === panelType &&
|
|
68
|
+
currentActiveMode.paneId === nodeId;
|
|
69
|
+
if (!entries[0].isIntersecting && stillActive) {
|
|
70
|
+
console.log('❌ CLOSING PANEL DUE TO INTERSECTION OBSERVER!', {
|
|
71
|
+
panelType,
|
|
72
|
+
nodeId,
|
|
73
|
+
});
|
|
74
|
+
nodesCtx.closeAllPanels();
|
|
75
|
+
}
|
|
76
|
+
}, 100); // Small delay to allow panel to render
|
|
60
77
|
}
|
|
61
78
|
},
|
|
62
79
|
{
|
|
63
|
-
threshold: 0.1,
|
|
64
|
-
rootMargin: '-10px',
|
|
80
|
+
threshold: 0.1,
|
|
81
|
+
rootMargin: '-10px',
|
|
65
82
|
}
|
|
66
83
|
);
|
|
67
84
|
|
|
68
85
|
observer.observe(currentWrapper);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
observer.disconnect();
|
|
72
|
-
};
|
|
73
|
-
}, [nodeId, panelType, nodesCtx, isActive]); // Include isActive in dependencies
|
|
86
|
+
return () => observer.disconnect();
|
|
87
|
+
}, [nodeId, panelType, nodesCtx, isActive]);
|
|
74
88
|
|
|
75
89
|
return (
|
|
76
90
|
<div
|
|
@@ -505,62 +505,56 @@ export default function SaveModal({
|
|
|
505
505
|
const { dirtyPaneIds, classes: dirtyClasses } =
|
|
506
506
|
ctx.getDirtyNodesClassData();
|
|
507
507
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
'X-Tenant-ID': tenantId,
|
|
521
|
-
},
|
|
522
|
-
credentials: 'include',
|
|
523
|
-
body: JSON.stringify(astroPayload),
|
|
524
|
-
});
|
|
525
|
-
|
|
526
|
-
if (!astroResponse.ok) {
|
|
527
|
-
throw new Error(
|
|
528
|
-
`CSS generation failed! status: ${astroResponse.status}`
|
|
529
|
-
);
|
|
530
|
-
}
|
|
508
|
+
// STEP 1: Generate CSS using Astro API
|
|
509
|
+
const astroEndpoint = `/api/tailwind`;
|
|
510
|
+
const astroPayload = { dirtyPaneIds, dirtyClasses };
|
|
511
|
+
const astroResponse = await fetch(astroEndpoint, {
|
|
512
|
+
method: 'POST',
|
|
513
|
+
headers: {
|
|
514
|
+
'Content-Type': 'application/json',
|
|
515
|
+
'X-Tenant-ID': tenantId,
|
|
516
|
+
},
|
|
517
|
+
credentials: 'include',
|
|
518
|
+
body: JSON.stringify(astroPayload),
|
|
519
|
+
});
|
|
531
520
|
|
|
532
|
-
|
|
521
|
+
if (!astroResponse.ok) {
|
|
522
|
+
throw new Error(
|
|
523
|
+
`CSS generation failed! status: ${astroResponse.status}`
|
|
524
|
+
);
|
|
525
|
+
}
|
|
533
526
|
|
|
534
|
-
|
|
535
|
-
throw new Error('CSS generation failed: no CSS returned');
|
|
536
|
-
}
|
|
527
|
+
const astroResult = await astroResponse.json();
|
|
537
528
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
529
|
+
if (!astroResult.success || !astroResult.generatedCss) {
|
|
530
|
+
throw new Error('CSS generation failed: no CSS returned');
|
|
531
|
+
}
|
|
541
532
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
const goResponse = await fetch(goEndpoint, {
|
|
546
|
-
method: 'POST',
|
|
547
|
-
headers: {
|
|
548
|
-
'Content-Type': 'application/json',
|
|
549
|
-
'X-Tenant-ID': tenantId,
|
|
550
|
-
},
|
|
551
|
-
credentials: 'include',
|
|
552
|
-
body: JSON.stringify(goPayload),
|
|
553
|
-
});
|
|
533
|
+
addDebugMessage(
|
|
534
|
+
`CSS generated: ${astroResult.generatedCss.length} bytes for ${dirtyClasses.length} classes`
|
|
535
|
+
);
|
|
554
536
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
537
|
+
// STEP 2: Save CSS to Go backend
|
|
538
|
+
const goEndpoint = `${goBackend}/api/v1/tailwind/update`;
|
|
539
|
+
const goPayload = { frontendCss: astroResult.generatedCss };
|
|
540
|
+
const goResponse = await fetch(goEndpoint, {
|
|
541
|
+
method: 'POST',
|
|
542
|
+
headers: {
|
|
543
|
+
'Content-Type': 'application/json',
|
|
544
|
+
'X-Tenant-ID': tenantId,
|
|
545
|
+
},
|
|
546
|
+
credentials: 'include',
|
|
547
|
+
body: JSON.stringify(goPayload),
|
|
548
|
+
});
|
|
558
549
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
`CSS saved successfully: stylesVer ${goResult.stylesVer}`
|
|
562
|
-
);
|
|
550
|
+
if (!goResponse.ok) {
|
|
551
|
+
throw new Error(`CSS save failed! status: ${goResponse.status}`);
|
|
563
552
|
}
|
|
553
|
+
|
|
554
|
+
const goResult = await goResponse.json();
|
|
555
|
+
addDebugMessage(
|
|
556
|
+
`CSS saved successfully: stylesVer ${goResult.stylesVer}`
|
|
557
|
+
);
|
|
564
558
|
} catch (error) {
|
|
565
559
|
const errorMsg =
|
|
566
560
|
error instanceof Error ? error.message : 'Unknown error';
|
|
@@ -113,9 +113,9 @@ export function setupLayoutObservers(): void {
|
|
|
113
113
|
toolModeNav.style.left = '0';
|
|
114
114
|
|
|
115
115
|
// Add margin to main content when nav becomes fixed (nav no longer takes flex space)
|
|
116
|
-
if (mainContent) {
|
|
117
|
-
|
|
118
|
-
}
|
|
116
|
+
//if (mainContent) {
|
|
117
|
+
// mainContent.classList.add('md:ml-16');
|
|
118
|
+
//}
|
|
119
119
|
} else {
|
|
120
120
|
// Normal static positioning when header is visible
|
|
121
121
|
toolModeNav.classList.remove('md:fixed');
|
|
@@ -124,9 +124,9 @@ export function setupLayoutObservers(): void {
|
|
|
124
124
|
toolModeNav.style.left = '';
|
|
125
125
|
|
|
126
126
|
// Remove margin from main content when nav is static (nav takes flex space naturally)
|
|
127
|
-
if (mainContent) {
|
|
128
|
-
|
|
129
|
-
}
|
|
127
|
+
//if (mainContent) {
|
|
128
|
+
// mainContent.classList.remove('md:ml-16');
|
|
129
|
+
//}
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
};
|