Files
klz-cables.com/.pnpm-store/v10/files/ee/426c35438aa434db53edab44b00d7b8ccfcb091e2b3942973e30076dd94cba0deb41fe0452ddd32667f780dd3756e2b60d78edffebc55293e8eb51cbca3c51
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

31 lines
1.1 KiB
Plaintext

import { Feature } from '../motion/features/Feature.mjs';
import { press } from 'motion-dom';
import { extractEventInfo } from '../events/event-info.mjs';
import { frame } from '../frameloop/frame.mjs';
function handlePressEvent(node, event, lifecycle) {
const { props } = node;
if (node.animationState && props.whileTap) {
node.animationState.setActive("whileTap", lifecycle === "Start");
}
const eventName = ("onTap" + (lifecycle === "End" ? "" : lifecycle));
const callback = props[eventName];
if (callback) {
frame.postRender(() => callback(event, extractEventInfo(event)));
}
}
class PressGesture extends Feature {
mount() {
const { current } = this.node;
if (!current)
return;
this.unmount = press(current, (startEvent) => {
handlePressEvent(this.node, startEvent, "Start");
return (endEvent, { success }) => handlePressEvent(this.node, endEvent, success ? "End" : "Cancel");
}, { useGlobalTarget: this.node.props.globalTapTarget });
}
unmount() { }
}
export { PressGesture };