All files / src/lib utils.ts

100% Statements 5/5
75% Branches 3/4
100% Functions 2/2
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18            55603x             52x 20x 20x    
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 Max Boksem. See NOTICE for additional terms under GPLv3 section 7.
 
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
 
export const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs));
 
/**
 * Whether a click on a clickable row landed on a button inside it, such as a
 * pin or a heart. The row leaves those clicks to the button, so the button
 * doesn't have to stop the event before listeners further up see it.
 */
export const isFromInnerButton = (e: { target: EventTarget; currentTarget: Element }): boolean => {
	const button = e.target instanceof Element ? e.target.closest("button") : null;
	return button !== null && e.currentTarget.contains(button);
};