Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
17 lines
573 B
TypeScript
17 lines
573 B
TypeScript
import type { Ref } from "solid-js"
|
|
|
|
export function isTabCloseTarget(target: EventTarget | null) {
|
|
return target instanceof Element && !!target.closest('[data-slot="tab-close"]')
|
|
}
|
|
|
|
export function canStartTabDrag(pointerType: string) {
|
|
return pointerType !== "touch"
|
|
}
|
|
|
|
export function forwardTabRef(ref: Ref<HTMLDivElement> | undefined, element: HTMLDivElement) {
|
|
if (typeof ref === "function") ref(element)
|
|
}
|
|
|
|
export function canOpenTabRename(dragging: boolean | undefined, editing: boolean, committing: boolean) {
|
|
return !dragging && !editing && !committing
|
|
}
|