feat(TypographyMenu): add bindable "open" prop to close popover from outside

This commit is contained in:
Ilia Mashkov
2026-04-17 16:30:41 +03:00
parent bb5c3667b4
commit 5eb9584797
2 changed files with 13 additions and 7 deletions

View File

@@ -52,6 +52,7 @@ const responsive = getContext<ResponsiveManager>('responsive');
const isMobile = $derived(responsive?.isMobile ?? false);
let isDragging = $state(false);
let isTypographyMenuOpen = $state(false);
// New high-performance layout engine
const comparisonEngine = new CharacterComparisonEngine();
@@ -76,6 +77,8 @@ function handleMove(e: PointerEvent) {
function startDragging(e: PointerEvent) {
e.preventDefault();
// Close typography menu popover
isTypographyMenuOpen = false;
isDragging = true;
handleMove(e);
}
@@ -222,7 +225,7 @@ const scaleClass = $derived(
class="
relative w-full max-w-6xl h-full
flex flex-col justify-center
select-none touch-none cursor-ew-resize
select-none touch-none outline-none cursor-ew-resize
py-8 px-4 sm:py-12 sm:px-8 md:py-16 md:px-12 lg:py-20 lg:px-24
"
in:fade={{ duration: 300, delay: 300 }}
@@ -253,6 +256,7 @@ const scaleClass = $derived(
</div>
<TypographyMenu
bind:open={isTypographyMenuOpen}
class={clsx(
'absolute z-50',
responsive.isMobileOrTablet