UNPKG

@shopify/shop-minis-react

Version:

React component library for Shopify Shop Minis with Tailwind CSS v4 support (source-only, requires TypeScript)

43 lines (42 loc) 1.36 kB
import { useNavigate as u, useLocation as m } from "../../shop-minis-react/node_modules/.pnpm/react-router@7.7.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-router/dist/development/chunk-EF7DTUVF.js"; import { DATA_NAVIGATION_TYPE_ATTRIBUTE as r } from "../../types/index.js"; function f() { const e = u(), o = m(); return (t, n) => { if (typeof t == "number") { if (document.startViewTransition) document.startViewTransition(() => { e(t); }).finished.then(() => { document.documentElement.removeAttribute( r ); }).catch((i) => { console.error("View transition error:", i); }); else return e(t); return; } const a = t === o.pathname, s = t === "/"; if (document.startViewTransition) document.startViewTransition(() => { s ? e(-window.history.state.idx) : e(t, { replace: a, ...n }), n?.preventScrollReset !== !0 && window.scrollTo(0, 0); }).finished.then(() => { document.documentElement.removeAttribute( r ); }).catch((i) => { console.error("View transition error:", i); }); else return e(t, n); }; } export { f as useNavigateWithTransition }; //# sourceMappingURL=useNavigateWithTransition.js.map